Comparing a table with floating positioning against one without produces unexpected result

The two attached files are minimal reproductions based on real documents I received. If you examine the XML, you’ll see that one has table properties of the form

<w:tblPr>
  <w:tblpPr w:leftFromText="187" w:rightFromText="187" w:vertAnchor="text"/>
</w:tblPr>

while the other table, which is otherwise identical, has no w:tblpPr. When these two documents are compared, the resultant properties are as follows:

<w:tblPr>
  <w:tblpPr w:leftFromText="0" w:rightFromText="0"/>
</w:tblPr>

This is incorrect; in a more complex document than those attached here those properties can cause the table to appear in the wrong position. The expected result is

<w:tblPr>
  <w:tblPrChange>
    <w:tblPr>
      <w:tblpPr w:leftFromText="187" w:rightFromText="187" w:vertAnchor="text"/>
    </w:tblPr>
  </w:tblPrChange>
</w:tblPr>

i.e., an indication that the floating positioning properties changed.

This is using Aspose.Words for Java, 21.10.

left.docx (11.1 KB)
right.docx (11.2 KB)

this is tracked internally as #6235.

@icsk Thank you for reporting this problem to use. But comparing your attached documents does not produce tblPrChange on my side, but it must. I logged this issue into our defect database as WORDSNET-22947. We will let you know once it is resolved.
However, please attach your original or less simplified documents here to reproduce your issue. We will check it once again and provide you more information. Also please attach the comparison result produced on your side and the code you use for comparing documents.

My apologies! I must have uploaded an earlier version of the reproduction document or something of the sort. In any case, I’ve recreated the documents from start to be sure (unfortunately they are highly sensitive, so I can’t provide the originals).

These documents exhibit both the underlying XML issue as well as the user-facing issue I mentioned before, namely, that the table in the output document appears above the adjacent paragraph, but it appears below the paragraph in both of the original documents.

I’ve also included the diff, as I see it in on my end.

I notice that the issue is slightly different than I originally describe. Aspose states that the table changed from float-positioned at 0, 0 to float-positioned at 187, 187, but in reality the table went from not-float-positioned to float-positioned at 187, 187. Or in XML: there is a w:tblpPr inside a w:tblPrChange, but there is also a w:tblpPr with zeroes as a direct child of w:tblPr. The latter node should not exist at all.

left.docx (11.5 KB)
right.docx (11.7 KB)
diff.docx (9.9 KB)

These were generated with the smallest possible Java program I could write:

public static void main(String[] args) throws Exception {
  configureAspose();

  if (args.length != 3) {
    throw new Exception("need exactly 3 arguments");
  }

  InputStream leftStream = new FileInputStream(new File(args[0]));
  InputStream rightStream = new FileInputStream(new File(args[1]));

  Document left = new Document(leftStream);
  Document right = new Document(rightStream);

  left.compare(right, "author", new Date());

  OutputStream output = new FileOutputStream(new File(args[2]));

  left.save(output, new OoxmlSaveOptions());
}

(where configureAspose just configures the license and font locations)

@icsk Thank you for additional information. I have managed to reproduce the problem and logged it as WORDSNET-22951 in our defect database. We will keep you informed and let you know once it is resolved.

1 Like

I’m unable to edit the original post, but I wanted to include a note to self: this is tracked internally as #6235.

@icsk I have added the note to the original post for convenience.

1 Like