|
| 1 | +--- |
| 2 | +title: Creating Custom Layout Tables with RadPdfProcessing |
| 3 | +description: Learn how to create tables with various column layouts using RadPdfProcessing. |
| 4 | +type: how-to |
| 5 | +page_title: How to Customize Table Layouts in RadPdfProcessing Documents |
| 6 | +slug: customize-table-layout-radpdfprocessing |
| 7 | +tags: pdfprocessing, document, processing, table, layout, customize, col, span, columnspan |
| 8 | +res_type: kb |
| 9 | +ticketid: 1660148 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +| Version | Product | Author | |
| 15 | +| --- | --- | ---- | |
| 16 | +| 2024.3.806| RadPdfProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| |
| 17 | + |
| 18 | +## Description |
| 19 | +Creating tables with customized layouts, including varying column spans, is a common requirement for document processing. This article demonstrates how to achieve a table with multiple rows, each having a different column layout, using the [RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) library. |
| 20 | + |
| 21 | +## Solution |
| 22 | + |
| 23 | +To create a table with varying column layouts, follow the steps below: |
| 24 | + |
| 25 | +1. Define a `Table` and set its `LayoutType` to `AutoFit`. Customize the `DefaultCellProperties` to set padding and borders for the cells. |
| 26 | +2. Add table rows using `table.Rows.AddTableRow()`. |
| 27 | +3. For each row, add cells using `row.Cells.AddTableCell()`. Customize each cell's content by adding blocks of text with specific styles (e.g., font family, font style, font weight). |
| 28 | +4. To change the column layout, set the `ColumnSpan` property of the cells accordingly. |
| 29 | +5. To adjust the row height, insert content with the desired height in each cell or use the `Padding` property for minor adjustments. |
| 30 | + |
| 31 | +Here's an example code snippet demonstrating the setup: |
| 32 | + |
| 33 | +```csharp |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +``` |
| 38 | + The code snippet achieves the below result: |
| 39 | + |
| 40 | +## See Also |
| 41 | + |
| 42 | +- [RadPdfProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) |
| 43 | +- [Working with Tables in RadPdfProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/table) |
0 commit comments