我可以像这样在Migradoc中创建一个标题:
//Create Header
Paragraph paragraph = section.Headers.Primary.AddParagraph();
paragraph.AddText("Roto");
paragraph.Format.Font.Size = 9;
paragraph.Format.Alignment = ParagraphAlignment.Center;
Run Code Online (Sandbox Code Playgroud)
我可以制作一个这样的简单表格:
// Create the HEADER table for the top of every page
this.table = section.AddTable();
this.table.Style = "Table";
this.table.Borders.Color = TableBorder;
this.table.Borders.Width = 0.25;
this.table.Borders.Left.Width = 0.5;
this.table.Borders.Right.Width = 0.5;
this.table.Rows.LeftIndent = 0;
Column column = this.table.AddColumn("8cm");
column.Format.Alignment = ParagraphAlignment.Center;
column = this.table.AddColumn("8cm");
column.Format.Alignment = ParagraphAlignment.Center;
// Create the header of the table
Row row = table.AddRow();
//row = table.AddRow();
row.HeadingFormat = true;
row.Format.Alignment = ParagraphAlignment.Center;
row.Format.Font.Bold = true;
row.Shading.Color = TableBlue;
row.Cells[0].AddParagraph("Rotary");
row.Cells[0].MergeRight = 1;
row = table.AddRow();
row.HeadingFormat = true;
row.Format.Alignment = ParagraphAlignment.Center;
row.Format.Font.Bold = true;
row.Shading.Color = TableBlue;
row.Cells[0].AddParagraph("Part No.:");
row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
row.Cells[1].AddParagraph("Tested by:");
row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
row = table.AddRow();
row.Cells[0].MergeRight = 1;
Run Code Online (Sandbox Code Playgroud)
如何将表格放入标题中,使其显示在每个页面的顶部?
编辑:为了使它工作,我改变了:
this.table = section.AddTable();
Run Code Online (Sandbox Code Playgroud)
至:
this.table = section.Headers.Primary.AddTable();
Run Code Online (Sandbox Code Playgroud)
Je *_*not 22
如果您希望在每个页面上都有相同的标题:
请使用section.Headers.Primary.AddTable()而不是section.Headers.Primary.AddParagraph().
通过设置row.HeadingFormat = true;表的前n行,可以将此行标记为标题行.当表增长并突破多个页面时,标题行将在每个页面上重复(但在"普通"页面主体中,而不是标题区域).这是标题行的典型用法.如果您不在标题表中添加其他行,则HeadingFormat = true将不会产生任何影响.
| 归档时间: |
|
| 查看次数: |
12203 次 |
| 最近记录: |