updateFields changes width of table's cell using Java

Hi,

we’re currently evaluating some features of the Aspose.Words API and ran into one issue.

When creating a table using the methods of DocumentBuilder, then the column widths differ, depending on whether updateFields is called before saving the document.

I’ve attached an eclipse project containing consisting of a test class. The main method creates a table and merges some cells. A PAGE field is inserted and updated afterwards, depending on the value of constant INSERT_PAGENUMER. The resulting document is then saved to disc.

The two included doc-files show, that the width of column 2 in the first file is not the same as in the second file.

Is this expected behavior? How can this be prevented?

Thanks, Michael Meier.

Hi Michael,

Thanks for your query. Please set the column width explicitly as show in following code snippet. Please read following documentation link for your kind reference.

docBuilder.insertCell();

docBuilder.getCellFormat().setPreferredWidth(PreferredWidth.fromPercent(33.33));

docBuilder.getFont().setBold(true);

docBuilder.write("column 1");

docBuilder.insertCell();

docBuilder.getCellFormat().setPreferredWidth(PreferredWidth.fromPercent(33.33));

docBuilder.write("column 2");

docBuilder.insertCell();

docBuilder.getCellFormat().setPreferredWidth(PreferredWidth.fromPercent(33.33));

docBuilder.write("column 3");

docBuilder.endRow();

Thank you, Tahir. Your answer solved this issue.

The issues you have found earlier (filed as WORDSNET-5857) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.