Articles in this section
Category / Section

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

3 mins 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.

C#

// 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.
document.Save("Sample.pdf");
document.Close(true);
// 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:

https://www.syncfusion.com/downloads/support/directtrac/general/ColumnSpan229410848.zip

 

Note:

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from a trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.

 

Conclusion

I hope you enjoyed learning about how to span a column in a PdfDocument by using the PdfLightTable.

You can refer to our WinForms PDF’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms PDF documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms PDF and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!


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