We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Append DOC Word Documents using C# .NET | Set Default Font, Keep Source Formatting or Use Destination Styles

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;


            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
            // merge to document in to one doc and keep two sections
            firstPageDoc.LastSection.PageSetup.SectionStart = SectionStart.NewPage;
            firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.KeepSourceFormatting);


            return firstPageDoc;

i think error getting from here

firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.KeepSourceFormatting);

how can i set source doc format .

firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.KeepSourceFormatting);

Assistant: connected
suren: hi
Assistant: Hello, thank you for reaching out to us. May I know your name please?
suren: suren
Assistant: Please provide your email address, this will help our team to reach back.
suren: surenslk@gmail.com
Assistant: Thank you for providing your details. You can always type “forget me” to remove these details.
Assistant: Welcome to Aspose, suren!
Assistant: How can I help you?
suren: i want to get more details reagarding aspose.word AppendDocument method
Assistant: Thanks for asking question. I’ll be forwarding your query to our technical support department.
Assistant: Anything else you want to add to your query before I forward it to our support department.
suren: i have a font issue
suren: it will alwasy gettting default font from second page onwards
suren: it will always getting default font from second page onwards
suren: but first page working properly
Assistant: suren, one last thing before I move forward. Please provide an appropriate subject line for your support ticket.
suren: AppendDocument Font issue
Assistant: One moment please, generating support ticket.


Please ZIP and attach the following resources here for testing:

  • Your simplified input Word documents
  • Aspose.Words for .NET 20.7 generated output DOCX file showing the undesired behavior
  • Your expected DOCX file showing the desired output. You can create this document by using MS Word.
  • A comparison screenshot highlighting the problematic areas in this Aspose.Words 20.7 generated document (with respect to your expected file)
  • Please also create a standalone simple Console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size

As soon as you get these pieces of information ready, we will start investigation into your particular scenario and provide you more information.

P.S: It is safe to attach files in the forum. If you attach your documents/resources here, only you and Aspose staff members can view/download them. You can also remove any sensitive information from documents by replacing it with dummy data instead.

hi thanks for you help.
i have used below code line. now seems to be ok.

firstPageDoc.AppendDocument(otherPagesDoc, ImportFormatMode.UseDestinationStyles);

i have setted this option : ImportFormatMode.UseDestinationStyles

Thank you.


It is great that you were able to find what you were looking for. You may also need to check the following pages:

1 Like

thank you very much