Questions regarding Aspose.Pdf.Table: table width- cellspacing and cellpadding features

I'm including a table when building a pdf document:

1.- Is there a way to make the table to be 100% the width of the document (considering the left and right margins)?

Let's say the table has 3 columns and I would like the columns to occupy "60% 20% 20%" so in total it occupies the 100%?

2.- How can I set the cellspacing and cellpadding of a Aspose.Pdf.Table?

Thanks...

Hello George,

Thanks for using our products.

You can specify the width information for table columns using SetColumnWidth method of Table class. In fact, first you need to get the page width information of page excluding Left and Right margins and then specify each column width with 60%, 20% and 20% proportion. Please try using the following code to get the page width information and how to specify the width of each column individually.

[C#]

// set the page width information excluding left and right margin
float tablewidth = pdf.PageSetup.PageWidth-pdf.PageSetup.Margin.Left-pdf.PageSetup.Margin.Right;
// get the 60% proportion of table width
float column1_Width = tablewidth * 60 / 100;
// get the 20% proportion of table width
float Column2_Width = tablewidth * 20 / 100;

// set first column width
tab1.SetColumnWidth(0, column1_Width);
// set second column widht information
tab1.SetColumnWidth(1, Column2_Width);
tab1.SetColumnWidth(2, Column2_Width);

Please visit the following links for information on

In case it does not satisfy your requiremnets or you have any further query, please feel free to contact.