please help me…
Problem : fonts are setting to default from second page onward. how can i set the font from original document?
my code
private Document ApplyMultiPageSetup(byte[] wordByte, WordPageSetupSettings firstPage, WordPageSetupSettings otherPages)
{
using (var stream = new MemoryStream(wordByte))
{
Document doc = new Document(stream);
// apply the first page settings to all pages and then get first page as new section
ApplyToPageSeup(doc.FirstSection.PageSetup, firstPage);
// Enforce fist section settings
doc.FirstSection.PageSetup.DifferentFirstPageHeaderFooter = true;
doc.UpdatePageLayout();
DocumentPageSplitter splitter = new DocumentPageSplitter(doc);
Document firstPageDoc = splitter.GetDocumentOfPage(1);
// create new empty document
Document otherPagesDoc = new Document();
// apply other pages settings to otherPagesDoc and add remaning pages from original document
ApplyToPageSeup(otherPagesDoc.FirstSection.PageSetup, otherPages);
// first page already in the firstPageDoc
for (int i = 2; i <= doc.PageCount; i++)
{
Aspose.Words.Document dstDoc = splitter.GetDocumentOfPage(i);
foreach (Section section in dstDoc)
{
// append all reamaining pages to first section of the otherPagesDoc document
otherPagesDoc.FirstSection.AppendContent(section);
}
}
// merge to document in to one doc and keep two sections
firstPageDoc.LastSection.PageSetup.SectionStart = SectionStart.NewPage;
firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.KeepSourceFormatting);
firstPageDoc.UpdateFields();
firstPageDoc.UpdatePageLayout();
return firstPageDoc;
}
}
i think error getting from here
firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.KeepSourceFormatting);