Articles in this section
Category / Section

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

2 mins 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



Note:

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from the trial setup or 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 draw the table when there is no space to draw the column.

 

You can refer to our Flutter PDF feature tour page to learn about its other groundbreaking features and documentation, and how to quickly get started with configuration specifications. You can also explore our Flutter PDF Flutter PDF examples 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 explore 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 forums 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