VegaRise.NET

Headers & Footers

Headers and footers are attached to sections. Use AddHeader/AddFooterwith a HeaderFooterType to target the Default, First, or Even variants. They are full containers — you can add paragraphs, images, tables, or shapes.

Simple Header and Footer

Use case: Add a title and page footer to every page.

C#
1using Vega;
2using Vega.DOM;
3
4var doc = new VDocs();
5
6doc.AddHeader(HeaderFooterType.Default).AddParagraph().AddText("Confidential Report");
7doc.AddFooter(HeaderFooterType.Even).AddParagraph().AddText("Internal Use Only");
8
9doc.AddParagraph().AddText("Body of the document.");
10doc.SaveAsWord("report.docx");

Different First-Page Header

Use case: Use a distinct cover header, different from other pages.

C#
1var section = doc.Sections.First();
2
3var coverHeader = section.AddHeader(HeaderFooterType.First);
4coverHeader.AddParagraph().AddText("Cover Page");
5
6var defaultHeader = section.AddHeader(HeaderFooterType.Default);
7defaultHeader.AddParagraph().AddText("Confidential");

Header with Image and Page Number

Use case: Show a logo and current page number in the header.

C#
1var header = doc.AddHeader(HeaderFooterType.Default);
2header.AddImage("logo.png").SetDimensions(60, 24, Units.pt);
3header.AddParagraph().AddText("Page "); // Page number field can be appended here

Frequently asked questions

Can headers differ per section?

Yes — call section.AddHeader(...) on the section you want to target.

Can a header contain images or tables?

Yes. DocumentHeaderFooterPart behaves like any other container — you can add paragraphs, images, tables, etc.

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in