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

Free Support Forum - aspose.com

Appending Document causes indent issues

We’re on Aspose v19.10 and have the following code to append one document to another:

var destination = new Document(wordDocStreams[0]);

for (var i = 1; i < wordDocStreams.Length; i++)
{
    var source = new Document(wordDocStreams[i]);
    source.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;
    source.FirstSection.HeadersFooters.LinkToPrevious(isLinkToPrevious: false);

    destination.AppendDocument(source, ImportFormatMode.KeepSourceFormatting);
}

These individual documents look just fine when opened by themselves, but when opening the combined document after appending them all together with the code above, the resulting document has indentation issues. We recently updated from v15.3 and that’s when the problem started occuring.

It’s worth mentioning that if I switch the ImportFormatCode from KeepSourceFormatting to KeepDifferentStyles the indentation problem goes away, but this introduces all sorts of sporadic font issues when the underlying styles differ between documents. Also worth mentioning is if I append these documents from within the Word application (Import -> Object) the indentation issue does NOT occur.

I’m attaching a ZIP containing the individual Word documents along with a combined Word document. Any help you can provide would be greatly appreciated!

Aspose.zip (63.2 KB)

@pahlquist,

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-19545. 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.

The issues you have found earlier (filed as WORDSNET-19545) have been fixed in this Aspose.Words for .NET 20.1 update and this Aspose.Words for Java 20.1 update.