Back to Devexpress

SubDocument.EndUpdateParagraphs(ParagraphProperties) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-dot-endupdateparagraphs-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraphproperties-x29.md

latest10.0 KB
Original Source

SubDocument.EndUpdateParagraphs(ParagraphProperties) Method

Finalizes the modification of paragraph formatting after the BeginUpdateParagraphs method call.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void EndUpdateParagraphs(
    ParagraphProperties properties
)
vb
Sub EndUpdateParagraphs(
    properties As ParagraphProperties
)

Parameters

NameTypeDescription
propertiesParagraphProperties

Contains paragraph formatting options.

|

Example

The following code snippet changes paragraph formatting in code:

csharp
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 document modification.
    document.EndUpdate();

    // Access the first paragraph's 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 tab stop modification.
    pp.EndUpdateTabs(tbiColl);

    // Finalize the paragraph edit operation.
    document.EndUpdateParagraphs(pp);
}
vb
Imports Microsoft.VisualBasic
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.Office.Utils

Using wordProcessor = New RicheditDocumentServer()
    ' Access a document.
    Dim document As Document = wordProcessor.Document

    ' Start to edit the document.
    document.BeginUpdate()

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

    ' Finalize document modification.
    document.EndUpdate()

    ' Access the first paragraph range
    Dim range As DocumentRange = document.Paragraphs(0).Range

    ' Start to edit the paragraph.
    Dim pp As ParagraphProperties = 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.
    Dim tbiColl As TabInfoCollection = pp.BeginUpdateTabs(True)

    ' Create a new tab stop for the paragraph.
    Dim tbi As TabInfo = 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 tab stop modification.
    pp.EndUpdateTabs(tbiColl)

    ' Finalize the paragraph edit operation.
    document.EndUpdateParagraphs(pp)
End Using

The following code snippets (auto-collected from DevExpress Examples) contain references to the EndUpdateParagraphs(ParagraphProperties) 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.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Formatting.cs#L80

csharp
// with this method call
document.EndUpdateParagraphs(pp);
#endregion #FormatParagraph

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/FormattingActions.cs#L64

csharp
pp.EndUpdateTabs(tbiColl);
document.EndUpdateParagraphs(pp);
#endregion #FormatParagraph

winforms-richedit-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L135

csharp
alignment.Alignment = ParagraphAlignment.Center;
document.EndUpdateParagraphs(alignment);
table[0, 1].VerticalAlignment = TableCellVerticalAlignment.Center;

word-document-api-table-examples/CS/Program.cs#L117

csharp
alignment.Alignment = ParagraphAlignment.Center;
document.EndUpdateParagraphs(alignment);
table[0, 1].VerticalAlignment = TableCellVerticalAlignment.Center;

winforms-rich-edit-implement-ms-office-word-format-painter/CS/DXApplication9/Form1.cs#L118

csharp
targetParagraphProperties.Assign(sourceParagraphProperties);
subDocument.EndUpdateParagraphs(sourceParagraphProperties);
targetSubDocument.EndUpdateParagraphs(targetParagraphProperties);

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Formatting.vb#L72

vb
' with this method call
            document.EndUpdateParagraphs(pp)
#End Region ' #FormatParagraph

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/FormattingActions.vb#L59

vb
pp.EndUpdateTabs(tbiColl)
            document.EndUpdateParagraphs(pp)
' #End Region ' #FormatParagraph

winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L111

vb
alignment.Alignment = ParagraphAlignment.Center
document.EndUpdateParagraphs(alignment)
table(0, 1).VerticalAlignment = TableCellVerticalAlignment.Center

word-document-api-table-examples/VB/Program.vb#L93

vb
alignment.Alignment = ParagraphAlignment.Center
document.EndUpdateParagraphs(alignment)
table(0, 1).VerticalAlignment = TableCellVerticalAlignment.Center

winforms-rich-edit-implement-ms-office-word-format-painter/VB/DXApplication9/Form1.vb#L107

vb
targetParagraphProperties.Assign(sourceParagraphProperties)
subDocument.EndUpdateParagraphs(sourceParagraphProperties)
targetSubDocument.EndUpdateParagraphs(targetParagraphProperties)

See Also

BeginUpdateParagraphs(DocumentRange)

BeginUpdateCharacters

EndUpdateCharacters(CharacterProperties)

SubDocument Interface

SubDocument Members

DevExpress.XtraRichEdit.API.Native Namespace