Articles in this section
Category / Section

How to span a column in a PdfDocument by using the PdfLightTable?

1 min read

You can span a column in the PdfDocument by using the PdfLightTable class. For this, you need to call the row events of the PdfLightTable and then apply the column span at the respective row index.


// Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
// Add a page to the document.
PdfPage page = document.Pages.Add(); 
//Create pdfLightTable.
PdfLightTable table = new PdfLightTable();
// Set the database into pdflighttable source. 
table.DataSource = CreateTable();
// Call the row events.
table.BeginRowLayout += new BeginRowLayoutEventHandler(table_BeginRowLayout);
// Draw the table into page.
table.Draw(page, new PointF(0, 0));          
// Save and close the document.
//Row event method.
private void table_BeginRowLayout(object sender ,BeginRowLayoutEventArgs args)
if (args.RowIndex == 0 || args.RowIndex == 4)
int[] span=new int[2]; //Array length is table.column count. 
span[0] = 2;
args.ColumnSpanMap = span;

Sample Link:


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment