We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

One Row Tables within a SDT Are Ignored

Hello,

We found an issue related to a Rich Text Structured Document Tag (SDT). If we create a rich text SDT which contains a table that has only one row, the SDT is ignored when opened via Aspose.Words. If the document is subsequently saved, the resulting document no longer contains the SDT from the original document (although the table remains intact).

Note that if the table contains two or more rows, then the SDT is recognized and remains intact after save. Alternately, if we add an empty paragraph before or after the one-row table, the SDT is recognized and remains intact. However, we would prefer not to add an extraneous row or empty paragraph to circumvent this issue.

Steps to reproduce:

  • Extract the two Word documents attached: SDT_Test1.docx & SDT_Test2.docx
  • Note that:
    • “SDT_Test1.docx” has a rich text SDT with a table that contains one row.
    • “SDT_Test2.docx” has three rich text SDTs. One has a table with a single row, the second has a table with two rows and the third has a table with one row and an empty paragraph.
  • Create the following Java program:
String docPath1 = “SDT_Test1.docx”;
String docPath2 = “SDT_Test2.docx”;

// first load a document by file path
Document wdDoc1 = new Document(docPath1);
NodeCollection nodes1 =
wdDoc1.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
// output the SDT count in the doc
System.out.println(“Number of SDTs in doc1: " + nodes1.getCount());
// output produces:
// Number of SDTs in doc1: 0
// But it should be 1

wdDoc1.save(docPath1.replace(”.docx", “-saved.docx”);
// when opened, the table remains but the SDT is gone

// load the second document by file path
Document wdDoc2 = new Document(docPath2);
NodeCollection nodes2 =
wdDoc2.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
// output the SDT count in the doc
System.out.println(“Number of SDTs in doc2: " + nodes2.getCount());
// output produces:
// Number of SDTs in doc2: 2
// But it should be 3

wdDoc2.save(docPath2.replace(”.docx", “-saved.docx”);
// when opened, the 2 of the 3 SDTs remain.
// The SDT with a single row table is gone


This issue can be reproduced using the latest Aspose.Words for Java version
16.1 (and any version prior). We reproduced it on:
  • Windows 7 running Java 1.7.0_85 and
  • LINUX 5 running Java
    1.7.0_85.

Thanks.

Hi,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13180. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

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


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