

WordDocumentBuilder builder = new WordDocumentBuilder(document) WordDocument document = new WordDocument()

And iDiTect.Word allows you to create different headers and footers for each section.īy default, all the secions's header and footer will inherit the rules in the first section. Section object in Word document can contains a single page, or a range of pages.

#How to insert pages in word doc how to#
This C# tutorial shows how to insert header/footer to sections in docx file. How to Create Header/Footer for different Sections in C# language Using (Stream stream = File.OpenRead( "footer2.png"))į().Inlines.AddImageInline().Image.ImageSource = new (stream, "png") įile.WriteAllBytes( "AddHeaderFooterForOddEvenPage.docx", wordFile.Export(document)) Using (Stream stream = File.OpenRead( "footer1.jpg"))į().Inlines.AddImageInline().Image.ImageSource = new (stream, "jpg") įooter footerEven = (HeaderFooterType.Even) ().Inlines.AddText( "even page header") įooter footerOdd = (HeaderFooterType.Default) Header headerEven = (HeaderFooterType.Even) Set this property as true to enable odd/even page headers and footersĭocument.HasDifferentEvenOddPageHeadersFooters = true Inserting text and image header/footer are both available. This C# tutorial shows how to add different header/footer to odd and even pages in Microsoft Word documents.įirst, you need set HasDifferentEvenOddPageHeadersFooters property to ture, it will allow the Docx document have the even page header/footer and odd page header/footer. How to Create Header/Footer for Odd/Even Page in C# language ( "simple footer") įile.WriteAllBytes( "SimpleHeaderFooter.docx", wordFile.Export(document)) WordDocument document = wordFile.Import(File.ReadAllBytes( "Sample.docx")) This C# tutorial shows how to insert header and footer in whole MS Word document.Īdding simple text header/footer, you can customize the text alignment, font style and color. How to Create Header/Footer for Every Page in C# language How to Create Headers and Footers to Word Document in C#.NET Code
