Append document destroys lists

Hello,

Aspose Words for Java (tested v19.2) has a bug when appending documents together with USE_DESTINATION_STYLES when there are linked Styles. In your documentation, you explain how to prevent list numberings from continuing. However, it does not work anymore. Even worse, the lists seem to mix up randomly. I have appended a unit test, which tries to explain it in detail. This bug seems to be introduced in v17.7, because the test works until version v17.6.

Thanks

Romain

@flammang,

Thanks for reporting this problem to us. Please also create a standalone simple Maven-enabled Java application (source code without compilation errors) that helps us to reproduce this problem on our end and attach it here for testing.

asposebug.zip (3.1 KB)

@flammang,

We have logged your problem in our issue tracking system. Your ticket number is WORDSNET-18228. We will further look into the details of this problem and will keep you updated on the status of the linked issue.

@flammang,

The Java code project you attached previously is quite complex. You are also using Lambdas and other modern language constructs. We request you to please simplify this code and attach a new project that does not use Lambdas but still reproduces the same problem with 19.2 version of Aspose.Words for Java. The project should also work when using old JDKs such as Java 5 or 6. Please provide a basic project for further testing. For example, assertThat(getParagraphListIds(template)).doesNotHaveDuplicates(); uses the following dependency:

<dependency>
	<groupId>org.assertj</groupId>
	<artifactId>assertj-core</artifactId>
	<version>3.1.0</version>
</dependency>

Please provide alternate of this line so that we do not have to use this dependency in POM file.

Thanks for your cooperation.

maven-jdk6.zip (3.1 KB)

@flammang,

We will keep you posted on further updates and let you when this issue will be resolved. Thanks.

The issues you have found earlier (filed as WORDSNET-18228) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.raza

@flammang,

Regarding WORDSNET-18228, it is to inform you that we have added a new overloaded of AppendDocument() method with additional ImportFormatOptions parameter as follows:

/// <summary>
/// Appends the specified document to the end of this document.
/// </summary>
/// <param name="srcDoc">The document to append.</param>
/// <param name="importFormatMode">Specifies how to merge style formatting that clashes.</param>
/// <param name="importFormatOptions">Allows to specify options that affect formatting of a result document.</param>
public void AppendDocument(Document srcDoc, ImportFormatMode importFormatMode, ImportFormatOptions importFormatOptions)

It allows to specify an additional options that affect formatting of a result document. Sample usage is as follows:

Document srcDoc = new Document("source.docx");
Document dstDoc = new Document("destination.docx");
 
ImportFormatOptions options = new ImportFormatOptions();
// Specify that if numbering clashes in source and destination documents, then a numbering from the source document will be used.
options.setKeepSourceNumbering(true);
dstDoc.appendDocument(srcDoc, ImportFormatMode.USE_DESTINATION_STYLES, options);

Hope, this helps.