Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Section.HeaderOffset Property

Returns the header offset from the top of the page.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public int HeaderOffset { get; }

#Property Value

Type Description
Int32

The offset, in twips.

#Remarks

The HeaderOffset property returns the header offset from the top of the page in the current section. Use the Margins property to get the header’s left, right, and bottom margins.

Section Margins

Call the section’s ChangePropertiesAsync(Action<SectionProperties>, CancellationToken) method to change the header offset.

Razor
<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            Section firstSection = await documentAPI.Sections.GetAsync(0);
            var header = await firstSection.GetHeaderAsync(HeaderFooterType.Primary, true);
            await header.AddTextAsync("Developer Express Inc.");          
            var hParagraph = await header.Paragraphs.GetAsync(0);
            await hParagraph.ChangePropertiesAsync(properties => {
                properties.Alignment = ParagraphAlignment.Right;
            });
            await firstSection.ChangePropertiesAsync(properties => {
                properties.HeaderOffset = 700;
            });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use methods of the UnitConverter class to convert centimeters, inches, pixels, or points to twips.

See Also