テーブルの追加
Documentize PDF Manager for .NET は、PDF ドキュメントにテーブルを組み込む作業を効率化する汎用コンポーネントです。データの整理、フォームの設計、ドキュメントの可読性向上など、さまざまなシナリオで正確かつ迅速にテーブル作成をサポートします。
テーブル付き PDF の作成
TableOptions クラスを使用して PDF に構造化されたテーブルを作成する手順は次のとおりです。
TableOptionsオブジェクトを設定し、テーブルの構造・内容・入出力ファイルを定義します。- テーブル、行、セルを PDF に追加します。
AddTableメソッドでテーブル生成プロセスを完了します。
例として以下をご覧ください。
1// Configure table options
2var options = new TableOptions();
3options.InsertPageBefore(1)
4 .AddTable()
5 .AddRow()
6 .AddCell().AddParagraph("Name")
7 .AddCell().AddParagraph("Age")
8 .AddRow()
9 .AddCell().AddParagraph("Bob")
10 .AddCell().AddParagraph("12")
11 .AddRow()
12 .AddCell().AddParagraph("Sam")
13 .AddCell().AddParagraph("20")
14 .AddRow()
15 .AddCell().AddParagraph("Sandy")
16 .AddCell().AddParagraph("26")
17 .AddRow()
18 .AddCell().AddParagraph("Tom")
19 .AddCell().AddParagraph("12")
20 .AddRow()
21 .AddCell().AddParagraph("Jim")
22 .AddCell().AddParagraph("27");
23// Add input file path
24options.AddInput(new FileData("path_to_input.pdf"));
25// Set output file path
26options.AddOutput(new FileData("path_to_output.pdf"));
27// Perform the process
28PdfManager.AddTable(options);テーブルのページ指定
PDF の 2 ページ目の前にテーブルを作成する手順は以下の通りです。例を示します。
1// Configure table options
2var options = new TableOptions();
3options.InsertPageBefore(2) // Add table before page 2
4 .AddTable()
5 .AddRow()
6 .AddCell().AddParagraph("Name")
7 .AddCell().AddParagraph("Age");
8// Add input file path
9options.AddInput(new FileData("path_to_input.pdf"));
10// Set output file path
11options.AddOutput(new FileData("path_to_output.pdf"));
12// Perform the process
13PdfManager.AddTable(options);主な機能
- 動的テーブル作成: PDF ドキュメント内に構造化されたテーブルを手軽に生成。
- ページ配置: PDF の任意の位置に正確にテーブルを挿入。
- レイアウトカスタマイズ: テーブル構造、セルの配置、スタイリングを自由に調整。