【发布时间】:2018-06-19 13:31:26
【问题描述】:
红色类型的段落生成多个页面。是否可以将 TextFrame(不在页眉或页脚中)显示在 MigraDoc 中的每个动态生成的页面/部分上,而不将其放在页眉或页脚中?
public static Document CreateWorkOrderPDF2(Document document, string filename, string WorkOrderHeader, string myMessage)
{
Section section = document.AddSection();
section.PageSetup.PageFormat = PageFormat.Letter;
section.PageSetup.StartingNumber = 1;
section.PageSetup.LeftMargin = 40;
//Sets the height of the top margin
section.PageSetup.TopMargin = 100;
section.PageSetup.RightMargin = 40;
section.PageSetup.BottomMargin = 40;
//HeaderFooter
HeaderFooter header = section.Headers.Primary;
header.Format.Font.Size = 16;
header.Format.Font.Color = Colors.DarkBlue;
//Image
MigraDoc.DocumentObjectModel.Shapes.Image headerImage = header.AddImage("../../Fonts/castorgate.regular.png");
headerImage.Width = "2cm";
Paragraph headerParagraph = header.AddParagraph(WorkOrderHeader);
headerParagraph.Format.Font.Name = "Consolas";
//Vertical Text
TextFrame WorkOrderVerticalTextFrame = section.AddTextFrame();
WorkOrderVerticalTextFrame.Orientation = TextOrientation.Downward;
//moves text to the right
WorkOrderVerticalTextFrame.Left = 550;
WorkOrderVerticalTextFrame.Width = 10;
WorkOrderVerticalTextFrame.Top = 0;
WorkOrderVerticalTextFrame.Height = 150;
WorkOrderVerticalTextFrame.WrapFormat.Style = WrapStyle.Through;
Paragraph WorkOrderVerticalParagraph = WorkOrderVerticalTextFrame.AddParagraph();
WorkOrderVerticalParagraph.Format.Alignment = ParagraphAlignment.Left;
WorkOrderVerticalParagraph.Format.Font.Name = "Consolas";
WorkOrderVerticalParagraph.Format.Font.Size = 8;
WorkOrderVerticalParagraph.AddText(WorkOrderHeader);
//WorkOrderVerticalParagraph.Format.Borders.Width = .5;
//BODY PARAGRAPH
Paragraph EstRecordsParagraph = section.AddParagraph(myMessage);
EstRecordsParagraph.Format.Font.Size = 10;
EstRecordsParagraph.Format.Font.Color = Colors.DarkRed;
EstRecordsParagraph.Format.Borders.Width = .5;
EstRecordsParagraph.Format.RightIndent = 0;
Paragraph renderDate = section.AddParagraph();
renderDate = section.AddParagraph("Work Order Generated: ");
renderDate.AddDateField();
return document;
}
【问题讨论】:
标签: migradoc