Articles in this section
Category / Section

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

1 min read

When you set the width of the column at a compile time and there is no space to draw the column with specified width in WinForms PDF, 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



Conclusion

I hope you enjoyed learning about how to draw the table when there is no space to draw the column in WinForms PDF.

You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms PDF example to understand how to create and manipulate data.

For current customers, you can check out our 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 other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-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 sign in to leave a comment
Access denied
Access denied