Unplanned
Last Updated: 24 Jul 2020 07:57 by Vipul
Vipul
Created on: 23 Jul 2020 12:59
Category: WordsProcessing
Type: Bug Report
0
WordsProcessing: PdfFormatProvider: Wrongly exported table width when table preferred width is set to fixed and it is greater than the available page width

Wrongly exported table width when the table preferred width is set to fixed:

<w:tblW w:w="11160" w:type="dxa"/>

and it is greater than the available page width: 

<w:pgSz w:w="12240" w:h="15840"/>
<w:pgMar w:top="630" w:right="1440" w:bottom="540" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>

Available page width = 12240 - (1440 + 1440) = 9360

A possible workaround is to set the page width to Auto:

IEnumerable<Table> tables = document.EnumerateChildrenOfType<Table>();
foreach (Table table in tables)
{
	if (table.PreferredWidth.Type == TableWidthUnitType.Fixed)
	{
		table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Auto, table.PreferredWidth.Value);
	}
}

 

1 comment
Vipul
Posted on: 24 Jul 2020 07:57
Thank you for the quick response. It works as expected after changing the width as suggested.