Tambah Tabel
The Documentize PDF Manager for .NET adalah komponen serbaguna yang dirancang untuk mempermudah integrasi tabel ke dalam dokumen PDF. Baik Anda mengatur data, merancang formulir, maupun meningkatkan keterbacaan dokumen, komponen ini menyederhanakan proses dengan tetap menjaga presisi dan efisiensi.
Membuat PDF dengan Tabel
Ikuti langkah‑langkah berikut untuk membuat tabel terstruktur dalam PDF menggunakan kelas TableOptions:
- Konfigurasikan objek
TableOptionsuntuk menentukan struktur tabel, konten, serta file input/output. - Tambahkan tabel, baris, dan sel ke PDF Anda.
- Selesaikan proses pembuatan tabel dengan menggunakan metode
AddTable.
Berikut contoh kode:
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);Menentukan Halaman Tabel
Ikuti langkah‑langkah berikut untuk menambahkan tabel pada PDF sebelum halaman ke‑2: Berikut contoh kode:
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);Fitur Utama:
- Pembuatan Tabel Dinamis: Membuat tabel terstruktur dalam dokumen PDF dengan mudah.
- Penempatan Halaman: Menyisipkan tabel pada lokasi tertentu dalam PDF dengan presisi.
- Tata Letak yang Dapat Disesuaikan: Mengatur struktur tabel, perataan sel, dan styling.