Formatting/Style issues when inserting sub-documents

Dear Aspose Words support,
we’re facing some style issues when trying to insert a word sub-document inside another word document.
In the simple test case I’ve prepared and attached, you may notice the following two main problems:

  • The sub-document contains a few numbered titles: in the output only the first title keeps the number, the other two titles loose the number.
  • There are a couple tables in the sub-document with some Arial text inside: in the output the Arial text becomes Times New Roman.

In the example the flag ImportFormatMode.KEEP_DIFFERENT_STYLES was used, but also using flag USE_DESTINATION_STYLES the problem remains.

Could you please suggest some workaround to get the subdocument properly inserted?

Thanks in advance for the support,
Kind Regards

SubDocumentIssues.zip (266.4 KB)

@fabrizio.vaglia Thank you for reporting the problems to us. For a sake for correction they have been logged as WORDSNET-23909 (Numbering issue) and WORDSNET-23910 (font issue). We will keep you informed and let you know once the issue are resolved or we have more information for your.
For now to get the desired output you can use ImportFormatMode.KEEP_SOURCE_FORMATTING.

Hello,
many thanks for your feedback.

Unfortunately, even using KEEP_SOURCE_FORMATTING in the real use case scenario (where both the document and the sub-document are much bigger), the resulting document has wrong styles (same issues described in the opening post).

@fabrizio.vaglia On my side code produces correct result if use ImportFormatMode.KEEP_SOURCE_FORMATTING and the documents you have attached earlier. Could you please attach sample documents that are imported improperly with ImportFormatMode.KEEP_SOURCE_FORMATTING? We will check the issue and provide you more information.

Hello,
it turns out that in our application there were multiple points where sub-documents got inserted and not all of them had been updated with the KEEP_SOURCE_FORMATTING flag.

Until regression tests will reveal some discrepancy in the output documents, this is good as workaround.
Thank you for your support so far,

Kind regards

@fabrizio.vaglia It is perfect that ImportFormatMode.KEEP_SOURCE_FORMATTING works correctly in your scenario. We will keep you informed and let you know once the original issues are resolved.

The issues you have found earlier (filed as WORDSNET-23910,WORDSNET-23909) have been fixed in this Aspose.Words for Java 22.7 update also available on Maven.