红色类型段落会生成多个页面。是否可以将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;
}
答案 0 :(得分:1)
否。
您可以将TextFrame添加到该部分;然后它将在该部分中出现一次。
您可以将TextFrame添加到页眉或页脚;那么它将显示在显示页眉或页脚的每个页面上。您可以为文本框架使用绝对位置,以使它们在页眉/页脚区域之外的页面上的任何位置。