Have you tried the latest version of Aspose.Words for .NET i.e. 19.8 on your end? In case the problem still remains, please ZIP and attach the following resources here for testing:
Your simplified input Word document
Aspose.Words 19.8 generated output document showing the undesired behavior
Your expected document showing the correct output. You can create expected document by using old Aspose.Words 13.7 version.
Please also create a simplified standalone console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
I forgot to precise that we work with the Java version of Aspose.
I update to the latest version 19.8.
After some investigation, the problem seems related to the list numbering when two documents are appended with “KEEP_SOURCE_FORMATING”.
Problem: When we append two documents containing a numbered list with ImportFormatMode.KEEP_SOURCE_FORMATTING, the numbering of the second document is changed.
Example:
Doc1 with following numbered list
0.1 …
0.2 …
0.3 …
Doc2 with following numbered list
1.1 …
1.2 …
1.3 …
outputDoc = doc1.append(Doc2)
Aspose.Words for Java provides various import options to format output documents. For your case, you need to set a boolean value that specifies how the numbering will be imported when it clashes in source and destination documents by using the ImportFormatOptions.KeepSourceNumbering property. Please try using the following code:
Document dstDoc = new Document("E:\\Example_docs\\doc1.doc");
Document srcDoc = new Document("E:\\Example_docs\\doc2.doc");
srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
ImportFormatOptions opts = new ImportFormatOptions();
opts.setKeepSourceNumbering(true);
dstDoc.appendDocument(srcDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING, opts);
dstDoc.save("E:\\Example_docs\\19.9.docx");
Yes, it works for two documents, but when I test it on real conditions, we merge 6 - 7 documents.
In this case, some documents have their numbered list removed.
Please find the example below, I test with two different output (DOC and DOCX)
Code JAVA:
Document dstDoc = null;
Document doc1 = null;
Document doc2 = null;
Document doc3 = null;
try {
dstDoc = new Document(“header_test.doc”);
doc1 = new Document(“intro_test.doc”);
doc2 = new Document(“chap1_test.doc”);
doc3 = new Document(“chap2_test.doc”);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImportFormatOptions opts = new ImportFormatOptions();
opts.setKeepSourceNumbering(true);
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. The ID of this issue is WORDSNET-19275. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
Unfortunately, your issue is not resolved yet. We have completed the analysis of this issue and will inform you via this thread as soon as this issue will be resolved in future or any further news may be available. We apologize for any inconvenience.