We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to draw the table when there is no space to draw the column?

Platform: WinForms |
Control: PDF

When you set the width of the column at a compile time and there is no space to draw the column with specified width, you can change the page size. You can increase the width and height of the page by using the PageSettings property.

Refer to the following code example to set the page’s width and height at a compile time.

C#

// Create a new instance of PdfDocument class.
PdfDocument document = new PdfDocument();
//Set page size
document.PageSettings.Size = new SizeF(1000, 1000);
// Add a page to the document.
PdfPage page = document.Pages.Add();
// DataTable data=Createtable();
DataTable data=Createtable();
//Create the light table
PdfLightTable pdfLineItemsTable = new PdfLightTable();
//Set the data into data source
pdfLineItemsTable.DataSource = data;
//Setting the width of the particular cells
pdfLineItemsTable.Columns[0].Width = 300;
pdfLineItemsTable.Columns[1].Width = 73;
pdfLineItemsTable.Columns[2].Width = 35;
pdfLineItemsTable.Columns[3].Width = 390;
pdfLineItemsTable.Draw(page, new RectangleF(26, 138, page.GetClientSize().Width - 50, 143));
// Save and close the document.
document.Save("Sample.pdf");
document.Close(true);

Sample Link

https://www.syncfusion.com/downloads/support/directtrac/general/PdfLightTableSample-1891723449.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile