Free Support Forum -

Wrong table width in PDF exports


We use insertHTML() to insert tables in Aspose documents, on which we apply table styles. As you can see, in the saved PDF file, the two tables have different width. However, in the Word file, the two tables are the same width.

In the following example, is a newly created model, from which we use the built-in “Table Grid” style to be applied to two HTML tables (we are using version 17.3.0) :

com.aspose.words.Document doc = new com.aspose.words.Document(“model.dotx”);

DocumentBuilder builder = new DocumentBuilder(doc);
String html = “” +
“<table width=“100%”>” +

” +
“<td width=“100%” colspan=“2”>Cell with colspan” +
“” +
“<td width=“77%”>Left cell” +
“<td width=“23%”>Right cell” +
“ ” +


" +
“<table width=“100%”>” +
“” +
“<td width=“77%”>Left cell” +
“<td width=“23%”>Right cell” +
“” +
builder.insertHtml(html, true);

for (Object node : doc.getChildNodes(NodeType.ANY, true)) {
if (node instanceof Table) {
Table table = (Table) node;
table.setStyle(doc.getStyles().get(“Table Grid”));

Could you please fix this issue or give us a work-around ?

Thanks a lot !

Hi Alexis,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15017. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Tahir,

Have you any news on this issue ?

In the meantime, can you suggest a workaround ?
We are using Aspose 18.11.

Thanks !



Thanks for your inquiry. The issue actually depends on the resolution of an internal extremely complex issue (WORDSNET-832). Therefore, WORDSNET-15017 has been postponed. We will review your issue after the resolution of WORDSNET-832. Unfortunately, there is no ETA available at the moment. We apologize for your inconvenience.

As a workaround, please call doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2003) method before saving document. Hope this helps you.