I can make the header in Migradoc as follows:
//Create Header Paragraph paragraph = section.Headers.Primary.AddParagraph(); paragraph.AddText("Roto"); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center;
And I can make a simple table as follows:
// 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;
How to get the table in the title so that it appears at the top of each page?
EDIT: Therefore, to make it work, I changed:
this.table = section.AddTable();
in
this.table = section.Headers.Primary.AddTable();
source share