Free Support Forum -

AppendDocument does not import styles correctly using .NET

I have a report packet I am writing that can either consist of a single set of reports, or multiple sets for different vendors. These templates are very carefully designed with specific row heights, cell alignments, and paragraph formatting.

The most important of the paragraph formatting is 0pt spacing after, and line spacing of “single”.

If I create each report one at a time, all the appropriate formatting is preserved.

If I build the report packet using the doc.appendDocument function, the paragraph formatting is reverted to 10pt after and “multiple” line spacing @ 1.15. This COMPLETELY destroys the formatting of our reports. The vertical justification on the cell spacing is lost due to the 10pt after setting, everything just looks really bad.

This occurs with both keepSourceFormatting and useDestinationStyle options for ImportFormatMode.

How can I join multiple documents together while retaining the paragraph formatting so carefully created in the templates?

I have attached a basic code and template sample demonstrating the issue.

Has there been any progress on this issue?

Is this issue being evaluated?

Hi David,

Thanks for your query. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-6789 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

Please use the following workaround for this issue:

Dim destStyleDoc As Document = aspose()


For i As Integer = 1 To 3

destStyleDoc.AppendDocument(aspose(), ImportFormatMode.UseDestinationStyles)


destStyleDoc.Save("./destStyleDoc.docx", SaveFormat.Docx)

We apologize for your inconvenience.

That worked until I added the cover page into the report. Either the cover page picks up the 10pt after, or the tables do (and also pick up the centered justification from the cover page).

I have attached a new code sample to demonstrate.

Hi David,

Thanks for sharing the information. Yes, cover page solution is same as the workaround shared in my previous reply. We will update you about the issue WORDSNET-6789 via this forum thread once this issue is resolved.

Please let us know if you have any more queries.

So… Either I can have the cover page formatted correctly, or the reports, but not both?

Hi David,

Thanks for your query. The problem is with Document.AppendDocument. I have verified the status of this issue from our issue tracking system and like to share with you that this issue is under analysis phase. We will update you via this forum thread once there is any further update available for this issue.

The issues you have found earlier (filed as WORDSNET-6789) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.