Back to Devexpress

Section.DifferentFirstPage Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-796ed87f.md

latest7.5 KB
Original Source

Section.DifferentFirstPage Property

Gets or sets whether the header and footer areas of the first page can be different from other pages in the section.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
bool DifferentFirstPage { get; set; }
vb
Property DifferentFirstPage As Boolean

Property Value

TypeDescription
Boolean

true to enable different settings for the first page; otherwise, false.

|

Remarks

Set the DifferentFirstPage property to true to display the header/footer of the HeaderFooterType.First type on the first page of the section. Otherwise, the first page will display the same header/footer as other pages, or the HeaderFooterType.Odd type header/footer if the Document.DifferentOddAndEvenPages property is true.

You can also use the ToggleDifferentFirstPageCommand command to enable/disable different first page.

Example

View Example

csharp
Document document = server.Document;
document.AppendSection();
Section firstSection = document.Sections[0];
// Modify the header of the HeaderFooterType.First type.
SubDocument myHeader = firstSection.BeginUpdateHeader(HeaderFooterType.First);
DocumentRange range = myHeader.InsertText(myHeader.CreatePosition(0), " PAGE NUMBER ");
Field fld = myHeader.Fields.Create(range.End, "PAGE \\* ARABICDASH");
myHeader.Fields.Update();
firstSection.EndUpdateHeader(myHeader);
// Display the header of the HeaderFooterType.First type on the first page.
firstSection.DifferentFirstPage = true;
vb
Dim document As Document = server.Document
document.AppendSection()
Dim firstSection As Section = document.Sections(0)
' Modify the header of the HeaderFooterType.First type.
Dim myHeader As SubDocument = firstSection.BeginUpdateHeader(HeaderFooterType.First)
Dim range As DocumentRange = myHeader.InsertText(myHeader.CreatePosition(0), " PAGE NUMBER ")
Dim fld As Field = myHeader.Fields.Create(range.End, "PAGE \* ARABICDASH")
myHeader.Fields.Update()
firstSection.EndUpdateHeader(myHeader)
' Display the header of the HeaderFooterType.First type on the first page.
firstSection.DifferentFirstPage = True

The following code snippets (auto-collected from DevExpress Examples) contain references to the DifferentFirstPage property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/HeaderAndFooter.cs#L41

csharp
// Display the header of the HeaderFooterType.First type on the first page.
firstSection.DifferentFirstPage = true;
#endregion #ModifyHeader

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/HeaderAndFooterActions.cs#L41

csharp
// Display the header of the HeaderFooterType.First type on the first page.
firstSection.DifferentFirstPage = true;
#endregion #ModifyHeader

word-document-api-examples/CS/CodeExamples/HeaderAndFooterActions.cs#L59

csharp
// Display the header on the first document page.
firstSection.DifferentFirstPage = true;
#endregion #ModifyHeader

how-to-add-a-watermark-to-the-document/CS/Form1.cs#L39

csharp
// Add an image watermark to the first page header.
firstSection.DifferentFirstPage = true;
richEditControl1.Document.WatermarkManager.SetImage(firstSection, HeaderFooterType.First,

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/HeaderAndFooter.vb#L37

vb
' Display the header of the HeaderFooterType.First type on the first page.
            firstSection.DifferentFirstPage = True
#End Region ' #ModifyHeader

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/HeaderAndFooterActions.vb#L36

vb
' Display the header of the HeaderFooterType.First type on the first page.
            firstSection.DifferentFirstPage = True
' #End Region ' #ModifyHeader

word-document-api-examples/VB/CodeExamples/HeaderAndFooterActions.vb#L47

vb
' Display the header on the first document page.
            firstSection.DifferentFirstPage = True
#End Region ' #ModifyHeader

how-to-add-a-watermark-to-the-document/VB/Form1.vb#L38

vb
Dim firstSection = richEditControl1.Document.Sections(0)
firstSection.DifferentFirstPage = True
richEditControl1.Document.WatermarkManager.SetImage(firstSection, HeaderFooterType.First, Image.FromFile(System.IO.Directory.GetCurrentDirectory() & "\..\..\preview.png"), imageWatermarkOptions)

See Also

ToggleDifferentFirstPageCommand

DifferentOddAndEvenPages

Section Interface

Section Members

DevExpress.XtraRichEdit.API.Native Namespace