Back to Devexpress

Section Interface

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-b991ab12.md

latest2.8 KB
Original Source

Section Interface

An interface that defines a section within a document.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[ComVisible(true)]
public interface Section
vb
<ComVisible(True)>
Public Interface Section

The following members return Section objects:

Example

The following code sample shows how to insert a continuous section break after the specified paragraph:

csharp
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer())
{
    wordProcessor.LoadDocument(@"Documents//Alice.docx");

    Document document = wordProcessor.Document;
    var section = document.InsertSection(document.Paragraphs[4].Range.End);

    // Retrieve the inserted section
    var sectionPosition = document.CreatePosition(section.Range.End.ToInt() + 1);
    Section insertedSection = document.GetSection(sectionPosition);
    insertedSection.StartType = SectionStartType.Continuous;

    wordProcessor.SaveDocument("Alice_formatted.docx", DocumentFormat.Docx);   
}
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native

Using wordProcessor = New RichEditDocumentServer()
    wordProcessor.LoadDocument("Documents//Alice.docx")

    Dim document As Document = wordProcessor.Document
    Dim section = document.InsertSection(document.Paragraphs(4).Range.End)

    ' Retrieve the inserted section
    Dim sectionPosition = document.CreatePosition(section.Range.End.ToInt() + 1)
    Dim insertedSection As Section = document.GetSection(sectionPosition)
    insertedSection.StartType = SectionStartType.Continuous

    wordProcessor.SaveDocument("Alice_formatted.docx", DocumentFormat.Docx)
End Using

See Also

Section Members

DevExpress.XtraRichEdit.API.Native Namespace