Hi
We are using Aspose.word.dll (version 10.0.0.0) (licensed)
We have multple word document which we have to append with our one master template and each document have specific category which have to add dynamically before the its content.
We are using DocumentBuilder.InsertHTML() method for inserting category as heading1 (h1) at the top of each document.
When we generate the output, it display the category as heading1 (which is correct) but the already heading present in that document comes as normal text (which is incorrect). It should come as the next heading
please find below code which we have used for appending multiple word document and inserting category in each word document.
Aspose.Words.Document genratedDocFrag = new Aspose.Words.Document(appendfile);
DocumentBuilder builder = new DocumentBuilder(genratedDocFrag);
builder.MoveToDocumentStart();
string html = "<h1>Heading1</h1>";
builder.InsertHtml(html);
DocumentBuilder docBuilderTemp = new DocumentBuilder(MasterTemplateDoc);
docBuilderTemp.MoveToDocumentEnd();
docBuilderTemp.InsertBreak(BreakType.SectionBreakNewPage);
foreach (Aspose.Words.Section srcSection in genratedDocFrag)
{
Aspose.Words.Section newSection = (Aspose.Words.Section)MasterTemplateDoc.ImportNode(srcSection, true, ImportFormatMode.UseDestinationStyles);
MasterTemplateDoc.LastSection.AppendContent(newSection);
}
MasterTemplateDoc.UpdateFields();
MasterTemplateDoc.Save(outputFileName); Aspose.Words.Document genratedDocFrag = new Aspose.Words.Document(appendfile);
DocumentBuilder builder = new DocumentBuilder(genratedDocFrag);
builder.MoveToDocumentStart();
string html = "<h1>Hardware</h1>";
builder.InsertHtml(html);
DocumentBuilder docBuilderTemp = new DocumentBuilder(MasterTemplateDoc);
docBuilderTemp.MoveToDocumentEnd();
docBuilderTemp.InsertBreak(BreakType.SectionBreakNewPage);
foreach (Aspose.Words.Section srcSection in genratedDocFrag)
{
Aspose.Words.Section newSection = (Aspose.Words.Section)MasterTemplateDoc.ImportNode(srcSection, true, ImportFormatMode.UseDestinationStyles);
MasterTemplateDoc.LastSection.AppendContent(newSection);
}
MasterTemplateDoc.UpdateFields();
MasterTemplateDoc.Save(outputFileName);
Please find the attached image in which “Hardware” heading we are adding but the text enclosed in recatngle is coming as normal text
Please let us know the solution ASAP.
Thanks
Samanvay