Adding a document to another- font styles being lost

Hi,

We’re using Aspose Words to build up a document from a number of template files, it all works except for the part where we want to allow the users to add a document at a specific location as designated by a merge field. When we do this, using the code below, the font styles in the extra document section of the finished document have reverted to Times New Roman, despite us using KeepSourceFormatting.

For the other aspects of the resulting document the font information is retained, just not in this instance. Only reason I can think of is because I’m putting the document into a document builder so I can search for the merge field. Not sure if I need to do this, but can’t find an equivalent of MoveToMergeField on the Document object.

Any ideas why the font info is lost?

(Aspose.Words.dll is version 6.5.0.0).

Thanks.

CODE:

// Fill in the extra document if there is one
Aspose.Words.DocumentBuilder db = new DocumentBuilder(doc);
bool bFoundExtraDoc = db.MoveToMergeField("EXTRADOC");

if (bFoundExtraDoc)
{
    db.Write("");

    if (extradocpath.Length> 0)
    {
        Document extradoc = new Document(extradocpath);
        for (int i = 0; i <extradoc.Sections.Count; i++)
        {
            Section section = (Section) db.Document.ImportNode(extradoc.Sections[i], true, ImportFormatMode.KeepSourceFormatting);
            db.CurrentSection.AppendContent(section);
        }
    }
}
doc = db.Document;

Hi

Thanks for your inquiry. You can try using method provided in the following article to insert one document into another at the specific location:
https://docs.aspose.com/words/java/insert-and-append-documents/
Please attach your documents here for testing. I will check the issue and provide you more information.
Also, please try using the latest version of Aspose.Words (6.6.0). You can download it from here:
https://releases.aspose.com/words/net
Best regards,

Thanks for the reply Andrey.

I’ve tried using the method you linked to, and with 6.6.0 and get the same issue.

Attached are the template files, we’re building a quote document so it basically does:

Add Aspose_Header.doc
for each QuoteSection in the Quote
Add Aspose_SectionHeader.doc
<<ExtraDoc>> replaced by contents of specified doc(Extra_Tape.doc for example) for each QuoteItem in the QuoteSection Add Aspose_Item.doc
next QuoteItem
Aspose_SectionFooter.doc
next QuoteSection

The result is seen in ResultingDoc.doc, you can see how the Extra documents have lost their font type.

Thanks again, appreciate your help with this.

Hi

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Best regards,

Thank you Andrey, can you give me any idea when a fixed version may be available? Just so I can tell our customers who are experiencing the issue.

Thanks for your request. Unfortunately, I cannot provide you any reliable estimate regarding this issue at the moment. Please expect a reply before next hotfix (within 4-5 weeks). We might just fix the problem or provide you more information.

Best regards,

Did this issue get resolved in the latest version? Just wondering if it’s worth upgrading.

Cheers.

Hi

Thanks for your inquiry. Unfortunately the problem is still unresolved. You will be notified as soon as it is resolved.
Best regards,

The issues you have found earlier (filed as 10430) have been fixed in this update.

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

2 posts were split to a new topic: Issue with Joining documents using Aspose.PDF