【发布时间】:2018-12-30 19:37:49
【问题描述】:
我需要在 MigraDoc 上添加页脚。 以下代码为所有页面添加页脚。
页面有一个需要出现在每个页面上的标题。
Document document = new Document();
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false);
Section HeaderSection = document.AddSection();
HeaderSection.PageSetup.DifferentFirstPageHeaderFooter = false;
MigraDoc.DocumentObjectModel.Shapes.Image image = HeaderSection.Headers.Primary.AddImage("../images/logo.jpg");
image.Height = new Unit(65);
image.Width = new Unit(150);
image.LockAspectRatio = false;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
Paragraph ParaHead1 = HeaderSection.AddParagraph();
Parahead1.AddFormattedText("..dfg");
Table table = HeaderSection.Footers.Primary.AddTable();
table.Borders.Width = 0;
Column column = table.AddColumn();
column.Width =Unit.FromPoint(300);
column.Format.Alignment = ParagraphAlignment.Left;
Column column1 = table.AddColumn();
column1.Width = Unit.FromPoint(200);
column1.Format.Alignment = ParagraphAlignment.Left;
Row row = table.AddRow();
Cell cell = row.Cells[0];
cell.AddParagraph("Regards,");
cell = row.Cells[1];
Paragraph para1 = cell.AddParagraph();
para1.AddFormattedText("Support Team");
我需要页脚表只出现在最后一页。
我不想添加将最后一段作为表格添加为页脚,因为这会导致页脚仅出现在文本中。
页面上的内容是动态的。
【问题讨论】:
-
我不确定最后一段是什么意思...