我前天开始使用 PDFSharp,并使用以下代码将图像添加到单元格:
Section section = this.document.AddSection();
Table table1 = section.Headers.Primary.AddTable();
Column column = table1.AddColumn("8.5cm");
column.Format.Alignment = ParagraphAlignment.Right;
column = table1.AddColumn("8.5cm");
column.Format.Alignment = ParagraphAlignment.Right;
Row row = table1.AddRow();
Image image = row.Cells[0].Elements.AddImage(@"C:\testdump\logo.jpg");
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Left;
image.WrapFormat.Style = WrapStyle.None;
我在这个之后添加了另一个表:
Table table2 = section.AddTable();
单元格中的图像与 table2 重叠。有谁知道为什么会这样?