Working with .NET PDF Tables
23 Jul 20267 minutes to read
The Syncfusion® .NET PDF library provides support for two types of PDF table models that offer different levels of customization. The two table models are:
NOTE
We strongly recommend using
PdfGridfor creating tables in PDF documents because it represents a flexible grid that supports a wider range of row and column customizations. UsePdfLightTableonly when you need a lightweight table with minimal formatting requirements.
Choosing the right table model
Use the following guidelines to choose between PdfGrid and PdfLightTable:
Choose PdfGrid when you need:
- Direct, typed access to individual rows, columns, and cells.
- Row span and column span support.
- Nested grids (a grid inside a cell).
- Built-in table styles and rich cell formatting.
Choose PdfLightTable when you need:
- A lightweight table for simple, data-bound reports.
- Minimal code and fewer customizations.
- Compatibility with legacy code that uses the
PdfLightTableAPI.
Difference between PdfLightTable and PdfGrid
Both the PdfGrid and PdfLightTable models are supported across all the platforms and the following table explains the level of customizations both the models provide.
| Features | PdfLightTable | PdfGrid |
|---|---|---|
|
Formatting |
||
| Row | No direct API, possible through events. | Yes |
| Column | Yes (StringFormat) | Yes (StringFormat) |
| Cell | No direct API for single cell formatting, possible through events. | Yes |
|
Others |
||
| Row span | No | Yes |
| Column span | No direct API, possible through events. | Yes |
| Nested Grid | Possible through events | Yes |
| Layout Events | BeginCellLayout, BeginPageLayout, BeginRowLayout, EndCellLayout, EndPageLayout, EndRowLayout | BeginPageLayout, EndPageLayout |