Thêm Bảng
The Documentize PDF Manager for .NET là một thành phần đa năng được thiết kế để đơn giản hoá việc tích hợp các bảng vào tài liệu PDF. Cho dù bạn đang sắp xếp dữ liệu, thiết kế biểu mẫu, hay cải thiện khả năng đọc tài liệu, thành phần này làm cho quy trình trở nên dễ dàng hơn đồng thời giữ độ chính xác và hiệu suất.
Tạo PDF với Bảng
Thực hiện các bước sau để tạo các bảng có cấu trúc trong PDF bằng cách sử dụng lớp TableOptions:
- Cấu hình đối tượng
TableOptionsđể định nghĩa cấu trúc bảng, nội dung và các tệp đầu vào/đầu ra. - Thêm bảng, hàng và ô vào PDF của bạn.
- Hoàn thiện quá trình tạo bảng bằng phương thức
AddTable.
Ví dụ:
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);Đặt trang cho bảng
Thực hiện các bước sau để tạo bảng trong PDF trước trang 2: Ví dụ:
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);Tính Năng Chính:
- Tạo Bảng Động: Tạo các bảng có cấu trúc trong tài liệu PDF một cách dễ dàng.
- Đặt Trang: Chèn bảng vào các vị trí cụ thể trong PDF một cách chính xác.
- Bố Cục Tùy Chỉnh: Điều chỉnh cấu trúc bảng, căn chỉnh ô và kiểu dáng.