Hi,
I'm using Aspose.Words to create document with .dot template. In template I have all possible columns in GUI has checkboxes which columns want to show in generated document.
I send not checking columns to method, after removing columns I want to fit table to entire document width. All did ok, just not want to have word break in table header (see attached image). I show result in PDF.
Please help how can I set headers with minimum width for text length or break word after end - not in the middle?
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
foreach (var columnHeader in TableColumnsForRemove)
{
int columnsCount = table.Rows[0].Cells.Count;
for (int x = 0; x < table.Rows[0].Cells.Count; x++)
{
if (table.Rows[0].Cells[x].Range.Text.ToString().StartsWith(columnHeader.ToString()))
{
Column column = Column.FromIndex(table, x);
if (column != null)
{
column.Remove();
}
}
}
}
// Autofit the table to the page width.
table.AutoFit(AutoFitBehavior.AutoFitToWindow);
I tried with PreferredWidth, but no success..