appendDocument gives different results based on order

using the example.

    TheDoc = new Document();

    foreach( var File in Filenames )
    {
         var SubDoc = new Document(File);
         TheDoc.AppendDocument(SubDoc, ImportFormatMode.KeepSourceFormatting);
    }

    TheDoc.Save( OutFilename, SaveFormat.Docx );

the order of the documents matters. In the attached upload, in the temp folder you can see the rtf documents in their intermediary docx format. They display properly. Especially the merge4.docx. This has dots for the top of the page and the bottom.

if you look at the rtfmerged.docx where the merge4 is the last document, the dots are rolled onto the next page. If you put merge4 first, then they dont. In our production environment I dont have control over the order, only in testing. see temp\merge4.docx for what it looks like normally,

visual studio source project provided. I added code to save them from rtf to docx intermediary so I could check the conversion.

Its only the append that has problems. I removed the aspose.words.dll from the zip file. and the license file.

mergertf problem.zip (471.1 KB)

@cdturner

Thanks for your inquiry. We have tested the scenario and noticed the reported issue. We have logged a ticket WORDSNET-15985 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Thank you.

as a secondary issue, when the rtf documents are converted to word or pdf, they appear to be missing the bug pdf417 barcodes on the 2nd and 3rd page. All images are png embeddings, how do I find out why those images wont translate ?

Thanks

Chris

merge4.rtf -> temp/merge4.docx shows the missing barcodes.

@cdturner

Thanks for your inquiry. We have tested the scenario and noticed the missing barcode images issue. We have logged a ticket WORDSNET-15991 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

@cdturner

Thanks for your patience. We have investigated the issue and found that problem occurs when appended document has header(footer) and it is appended without header(footer). To resolve this we have to unlink HeaderFooters from previous section, but it will add extra empty space. So, a workaround to resolve this issue is to add zero-height headers/footers. Please check following code snippet for the purpose.

string[] files = Directory.GetFiles(@"D:\Downloads\mergertf problem\sample");
 
Document TheDoc = new Document();
TheDoc.RemoveAllChildren();
foreach (var File in files)
{
    var SubDoc = new Document(File);
    TheDoc.AppendDocument(SubDoc, ImportFormatMode.KeepSourceFormatting);
}
//change header(footer) height to 0
foreach (Section section in TheDoc.Sections)
{
    if (section.HeadersFooters.Count == 0)
    {
        PageSetup pageSetup = section.PageSetup;
        pageSetup.FooterDistance = 0;
        pageSetup.HeaderDistance = 0;
    }
    section.HeadersFooters.LinkToPrevious(false);
}
            
TheDoc.Save(@"D:\Downloads\mergertf problem\append_1710.docx", SaveFormat.Docx);

Thank you very much. Are there any downsides you see to this approach ? It certainly solves this issue.

I will run it over a larger sampling of our documents we generate over the next few days.

@cdturner

Thanks for your feedback. There is no known issue with the approach. It will help you to accomplish the task in production as well. However, if you face any issue in this regard then please let us know. We will be more than happy to extend our support.

@cdturner,
The issues you have found earlier (filed as WORDSNET-15991) have been fixed in this Aspose.Words for .NET 18.1 update and this Aspose.Words for Java 18.1 update.
Please also check the following articles: