Create Table for PDF in .NET SDK
Create a Table with extended properties for PDF Document using server-side .NET API.
Get StartedHow to create Table for PDF via Cloud .NET SDK
In order to create Table for PDF via Cloud .NET SDK , we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Pdf-Cloud
Steps to create Table for PDF via .NET SDK
Aspose.PDF Cloud developers can easily load & create Table with extended properties for PDF in just a few lines of code.
- Upload the File to Cloud Storage
- Define the Table’s Appearance
- Define Table Content
- Add the Table to the PDF
- Download the Updated File
This sample code shows adding Table to PDF documents
using Aspose.Pdf.Cloud.Sdk.Model;
namespace Tables
{
public class TableCreate
{
public static Table New()
{
int num_of_cols = 5;
int num_of_rows = 5;
TextState header_text_state = new TextState(
Font: "Arial Bold",
FontSize: 11,
ForegroundColor: new Color(A: 255, R: 255, G: 255, B: 255),
FontStyle: FontStyles.Bold);
TextState common_text_state = new TextState(
Font: "Arial Bold",
FontSize: 11,
ForegroundColor: new Color(A: 255, R: 112, G: 112, B: 112),
FontStyle: FontStyles.Regular);
string col_widths = string.Empty;
for (int col_index = 0; col_index < num_of_cols; col_index++)
{
col_widths += " 70";
}
List<Row> table_rows = new List<Row>();
GraphInfo border_table_border = new GraphInfo(
Color: new Color(A: 255, R: 0, G: 255, B: 0),
LineWidth: 0.5);
for (int row_index = 0; row_index < num_of_rows; row_index++)
{
List<Cell> row_cells = new List<Cell>();
for (int col_index = 0; col_index < num_of_cols; col_index++)
{
Cell cell = new Cell(DefaultCellTextState: common_text_state, Paragraphs: new List<TextRect>());
if (row_index == 0)
{ // header cells
cell.BackgroundColor = new Color(A: 255, R: 128, G: 128, B: 128);
cell.DefaultCellTextState = header_text_state;
}
else
{
cell.BackgroundColor = new Color(A: 255, R: 255, G: 255, B: 255);
cell.DefaultCellTextState = common_text_state;
};
TextRect text_rect = new TextRect();
if (row_index == 0)
{
text_rect.Text = "header #" + col_index.ToString();
}
else
text_rect.Text = string.Format("value '{0}', '{1}'", row_index, col_index);
cell.Paragraphs.Add(text_rect);
row_cells.Add(cell);
}
Row row = new Row(Cells: row_cells);
table_rows.Add(row);
}
Table table = new Table(Left: 150, Top: 250, ColumnWidths: col_widths, Rows: table_rows);
table.DefaultCellBorder = new BorderInfo(
Top: border_table_border,
Right: border_table_border,
Bottom: border_table_border,
Left: border_table_border,
RoundedBorderRadius: 2);
return table;
}
}
}
Work with Table in PDF
Tables provide a structured format for presenting data systematically, making it easier for readers to understand and analyze information. They also enhance the visual appeal of a document, adding professionalism and organization. When dealing with numerical or comparative data, tables improve clarity by grouping related information in an easy-to-read format. Additionally, tables can incorporate real-time or dynamically generated content, such as data from databases or analytics dashboards. Create the Table with extended properties for PDF documents with Aspose.PDF Cloud Node.js SDK.
With our .NET library you can:
- Add PDF document’s header & footer in text or image format.
- Add tables & stamps (text or image) to PDF documents.
- Append multiple PDF documents to an existing file.
- Work with PDF attachments, annotations, & form fields.
- Apply encryption or decryption to PDF documents & set a password.
- Delete all stamps & tables from a page or entire PDF document.
- Delete a specific stamp or table from the PDF document by its ID.
- Replace single or multiple instances of text on a PDF page or from the entire document.
- Extensive support for converting PDF documents to various other file formats.
- Extract various elements of PDF files & make PDF documents optimized.
- You can try out our free App to extract Table into PDF files online and test the functionality.
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for .NET?
- Customers List
- Security