10

次のように、Migradoc でヘッダーを作成できます。

  //Create Header
  Paragraph paragraph = section.Headers.Primary.AddParagraph();
  paragraph.AddText("Roto");
  paragraph.Format.Font.Size = 9;
  paragraph.Format.Alignment = ParagraphAlignment.Center;

そして、次のような単純なテーブルを作成できます。

  // 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;

表をヘッダーに挿入して、すべてのページの上部に表示するにはどうすればよいですか?

編集:それを機能させるために、私は変更しました:

this.table = section.AddTable();

に:

this.table = section.Headers.Primary.AddTable();
4

1 に答える 1

25

すべてのページに同じヘッダーを付けたい場合:の代わりに
使用します。section.Headers.Primary.AddTable()section.Headers.Primary.AddParagraph()

テーブルの最初の n 行を設定row.HeadingFormat = true;することにより、この行をヘッダー行としてマークします。表が大きくなり、複数のページに分割されると、ヘッダー行はすべてのページで繰り返されます (ただし、ヘッダー領域ではなく、「通常の」ページ本体で)。これは、見出し行の一般的な使用法です。ヘッダー テーブルに他の行を追加しない場合、HeadingFormat = true は効果がありません。

于 2013-08-05T12:26:54.837 に答える