Table Column width is incorrect when generating DOC from HTML. For some reason column width depends on Aspose tag length. For example, if you have
<td><<[name]>></td> than column will be small. But if you have
<td><<[someLongNameGoesHere]>></td> the column width will suddenly become too wide. This is also true when accessing properties hierarchy using dot notation like
I suspect Aspose tries to fit tag into column, and probably it should instead try to fit output of the tag into column.
It is not always possible to make names very short. Would be good if Aspose could set column width based on real text being inserted into template.
Java sample attached. It creates two documents that contain a table. Table columns have predefined width. All columns respect width, except for one that contains Aspose tag. The only difference between those documents is Aspose tag length.
fieldNameIsLong.doc shows what is being generated when Aspose tag is long. Column that holds text “BMW” is very wide, eating up space for other columns.
fieldNameIsShort.doc shows what is being generated when Aspose tag is short. Column that holds text “BMW” is OK.
Expected output: fieldNameIsLong.doc has 2nd column width 10%, because text “BMW” fits into such width. Column 2 is expected to be the same width as columns 1 and 3.
HtmlWidth.zip (28.8 KB)
Note: i had to remove aspose jar from attachment because it was not possible to upload 12Mb. So please put “aspose-words-19.4-jdk17.jar” into sample’s “lib” folder.