Adicionar Tabela
O Documentize PDF Manager for .NET é um componente versátil projetado para simplificar a integração de tabelas em documentos PDF. Seja organizando dados, projetando formulários ou melhorando a legibilidade do documento, este componente simplifica o processo enquanto mantém precisão e eficiência.
Criando um PDF com Tabelas
Siga estas etapas para criar tabelas estruturadas em um PDF usando a classe TableOptions:
- Configure o objeto
TableOptionspara definir a estrutura da tabela, o conteúdo e os arquivos de entrada/saída. - Adicione tabelas, linhas e células ao seu PDF.
- Finalize o processo de geração da tabela usando o método
AddTable.
Veja um exemplo:
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);Definir a página da tabela
Siga estas etapas para inserir a tabela em um PDF antes da página 2: Veja um exemplo:
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);Principais Recursos:
- Criação Dinâmica de Tabelas: Gere tabelas estruturadas em documentos PDF com facilidade.
- Posicionamento de Página: Insira tabelas em locais específicos dentro de um PDF com precisão.
- Layout Personalizável: Ajuste a estrutura da tabela, o alinhamento das células e a estilização.