Skip to content

Commit

Permalink
Avoid unnecessary casts.
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiamurialdo committed Sep 26, 2023
1 parent b702862 commit ef31954
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions dotnet/src/dotnetcore/GxPdfReportsCS/PDFReportItext8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -974,32 +974,27 @@ private void ProcessHTMLElement(Rectangle htmlRectangle, YPosition currentYPosit
return;
}

Paragraph p = blockElement as Paragraph;
Table table = blockElement as Table;
List list = blockElement as List;
Link anchor = blockElement as Link;
Image image = blockElement as Image;
if (p != null)
if (blockElement is Paragraph p)
{
p.SetFixedPosition(this.getPage(), htmlRectangle.GetX(), currentYPosition.CurrentYPosition - blockElementHeight, htmlRectangle.GetWidth());
document.Add(p);
}
else if (table != null)
else if (blockElement is Table table)
{
table.SetFixedPosition(this.getPage(), htmlRectangle.GetX(), currentYPosition.CurrentYPosition - blockElementHeight, htmlRectangle.GetWidth());
document.Add(table);
}
else if (list != null)
else if (blockElement is List list)
{
list.SetFixedPosition(this.getPage(), htmlRectangle.GetX(), currentYPosition.CurrentYPosition - blockElementHeight, htmlRectangle.GetWidth());
document.Add(list);
}
else if (anchor != null)
else if (blockElement is Link anchor)
{
anchor.SetFixedPosition(this.getPage(), htmlRectangle.GetX(), currentYPosition.CurrentYPosition - blockElementHeight, htmlRectangle.GetWidth());
document.Add((IBlockElement)anchor);
}
else if (image != null)
else if (blockElement is Image image)
{
image.SetFixedPosition(this.getPage(), htmlRectangle.GetX(), currentYPosition.CurrentYPosition - blockElementHeight, htmlRectangle.GetWidth());
document.Add(image);
Expand Down

0 comments on commit ef31954

Please sign in to comment.