Skip to main content

SubDocument.BeginUpdateParagraphs(DocumentRange) Method

Starts modifying properties of the paragraphs that fall within a specified document range.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.1.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

ParagraphProperties BeginUpdateParagraphs(
    DocumentRange range
)

Parameters

Name Type Description
range DocumentRange

A DocumentRange specifying the DocumentRange.Start and DocumentRange.End of the text.

Returns

Type Description
ParagraphProperties

A ParagraphProperties object representing paragraph formatting.

Example

The code sample below shows how to change paragraph formatting in code:

result

using DevExpress.XtraRichEdit.API.Native;
using DevExpress.Office.Utils;

using (var wordProcessor = new RicheditDocumentServer())
{
    // Access a document.
    Document document = wordProcessor.Document;

    // Start to edit the document.
    document.BeginUpdate();

    // Append text to the document.
    document.AppendText("Modified Paragraph\nNormal\nNormal");

    // Finalize to edit the document.
    document.EndUpdate();

    // Access the first paragraph range
    DocumentRange range = document.Paragraphs[0].Range;

    // Start to edit the paragraph.
    ParagraphProperties pp = document.BeginUpdateParagraphs(range);

    // Specify the paragraph's alignment.
    pp.Alignment = ParagraphAlignment.Center;

    // Specify the paragraph's line spacing.
    pp.LineSpacingType = ParagraphLineSpacing.Multiple;
    pp.LineSpacingMultiplier = 3;

    // Set the paragraph's left indent to 0.5 document unit.
    // Default unit is 1/300 of an inch (a document unit).
    pp.LeftIndent = Units.InchesToDocumentsF(0.5f);

    // Start to modify tab stops in the paragraph.
    TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);

    // Create a new tab stop for the paragraph.
    TabInfo tbi = TabInfo();

    // Specify the tab stop's alignment type.
    tbi.Alignment = TabAlignmentType.Center;

    // Set the tab stop position to 1.5 document unit.
    tbi.Position = Units.InchesToDocumentsF(1.5f);

    // Add the tab stop to the collection of tab stops.
    tbiColl.Add(tbi);

    // Finalize to modify tab stops in the paragraph.
    pp.EndUpdateTabs(tbiColl);

    // Finalize to edit the paragraph.
    document.EndUpdateParagraphs(pp);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the BeginUpdateParagraphs(DocumentRange) method.

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.

See Also