Numbering chapters disappear


#1

Hello,

We recently moved from Aspose.word 13.7.0.0 to Aspose.word 17.9.
Process of the generated document:

  • Every part is a chapter with numbering and text
  • Every part are merged into one document
    Problem:
  • Since we upgrade the Aspose version, only the first part have a correct numbering, others part have no numbering

Is this a known issue?

Thanks for you support.


#2

@tdagut,

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.


#3

Hello,

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)

Expected content of outputDoc:
	   0.1 ..
	   0.2 ..
	   0.3 ..
	   1.1 ..  
	   1.2 ..
	   1.3 ..
Content of outputDoc:
	   0.1 ..
	   0.2 ..
	   0.3 ..
	   0.1 ..
	   0.2 ..
	   0.3 ..

Our problem is that numbered list does not keep their numbering in the output document.

Java Code:
Document dstDoc = null;
Document srcDoc = null;
try {
dstDoc = new Document(“doc1.doc”);
srcDoc = new Document(“doc2.doc”);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);

dstDoc.appendDocument(srcDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
dstDoc.save("output.doc");
System.out.println("Save done");

Files:
Example_docs.zip (31.7 KB)

Thank you in advance for your support, it is a blocking point for our customers.
Best regards,


#4

@tdagut1,

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");

#5

Hello @awais.hafeez,

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);

	doc1.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
	doc2.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
	doc3.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);

	dstDoc.appendDocument(doc1, ImportFormatMode.KEEP_SOURCE_FORMATTING, opts);
	dstDoc.appendDocument(doc2, ImportFormatMode.KEEP_SOURCE_FORMATTING, opts);
	dstDoc.appendDocument(doc3, ImportFormatMode.KEEP_SOURCE_FORMATTING, opts);

	try {
		dstDoc.save("output.doc",
				SaveFormat.DOC);
		dstDoc.save("output.docx",
				SaveFormat.DOCX);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	System.out.println("Save Done");

Files attached:
test_aspose.zip (83.4 KB)

Thank you for your investigation,
Best regards,


#6

@tdagut1,

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.


#7

Hello @awais.hafeez,

Do you have any news regarding the issue WORDSNET-19275 ?

Best regards,


#8

@tdagut1,

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.