GetMaxColumnWidth() truncating some data in column

I am importing a datatable with unknown column widths. I import the datatable by setting each column to '300' - more than enough room for the data. However, when using the GetMaxColumnWidth(), it seems to truncate some text. Any ideas where I am going wrong? Or if there is an easier way to set the datatables columns to the proper width? Here is the example of my code:

Pdf pdf1 = new Pdf();

Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();

sec1.Paragraphs.Add(tab1);

for (int i = 0; i <= dt.Columns.Count; i++)

{

string width = " 300 ";

tab1.ColumnWidths += width;

tab1.Title = report.Header.Title;

}

tab1.ImportDataTable(dt, true, 0, 0);

for (int i = 0; i < dt.Columns.Count; i++)

{

tab1.SetColumnWidth(i, tab1.GetMaxColumnWidth(pdf1, i));

}

pdf1.Save("c:\\test.pdf");

Here is a sample of the output to PDF: - the truncated field is in red - should be' Magic Valley Medical Center' - Changing the value of width in the code to '400' or '500' makes no difference.

H61 Clyde Gassert Magic Valley Medical Cent 30057891/23/2010 2:48:57 AMCORPLDRAKEGA11 False False

H61 Clyde Gassert Cassia School Lunch 30105611/23/2010 2:48:57 AMCORPLDRAKEGA11 False False

H61 Clyde Gassert Dietrich School Lunch 30118511/23/2010 2:48:57 AMCORPLDRAKEGA11 False False

Hello Ray,

Thanks for using our products.

I've tested the scenario using Aspose.Pdf for .NET 4.1.2 and I'm unable to notice any problem. The resultant PDF that I've generated using the code snippet that you've shared is in attachment.

You can also use the following code line to set the columns width

[C#]
//Set with column widths of the table
tab1.ColumnWidths = "50 50 50";

For more information, please visit ColumnWidths and Set Width and Span of the Column

In case you still face any problem or you've any further query, please feel free to contact.

We apologize for your inconvenience.