Back to Devexpress

IdxRichEditSubDocument.BeginUpdateParagraphs(IdxRichEditDocumentRange) Method

vcl-dxrichedit-dot-nativeapi-dot-idxricheditsubdocument-dot-beginupdateparagraphs-x28-dxrichedit-dot-nativeapi-dot-idxricheditdocumentrange-x29.md

latest3.3 KB
Original Source

IdxRichEditSubDocument.BeginUpdateParagraphs(IdxRichEditDocumentRange) Method

Starts to update the properties of one or more paragraphs to which the specified document range belongs.

Declaration

delphi
function BeginUpdateParagraphs(const ARange: IdxRichEditDocumentRange): IdxRichEditParagraphProperties;

Parameters

NameTypeDescription
ARangeIdxRichEditDocumentRange

The target document range.

|

Returns

TypeDescription
IdxRichEditParagraphProperties

The target paragraph’s properties.

|

Remarks

A BeginUpdateParagraphs function call obtains properties of one or more paragraphs to which the target document range belongs. The EndUpdateParagraphs procedure accepts these paragraph settings and applies the changes made between BeginUpdateParagraphs and EndUpdateParagraphs calls.

Code Example: Customize Paragraph Settings

The following code example justifies the paragraph where the caret is located and sets a 2-centimeter first line indent:

delphi
var
  ADocument: IdxRichEditDocument;
  AParagraphProperties: IdxRichEditParagraphProperties;
begin
  ADocument := dxRichEditControl1.Document;
  ADocument.&Unit := TdxRichEditDocumentUnit.Centimeter;
  // Obtains properties of the paragraph where the caret is located
  AParagraphProperties := ADocument.BeginUpdateParagraphs(ADocument.Selection);
  AParagraphProperties.Alignment := TdxRichEditParagraphAlignment.Justify;
  AParagraphProperties.FirstLineIndentType := TdxRichEditParagraphFirstLineIndent.Indented;
  AParagraphProperties.FirstLineIndent := 2;
  ADocument.EndUpdateParagraphs(AParagraphProperties); // Applies the changes to the current paragraph
end;
cpp
_di_IdxRichEditDocument ADocument;
  _di_IdxRichEditParagraphProperties AParagraphProperties;
  // ...
  ADocument = dxRichEditControl1->Document;
  ADocument->Unit = TdxRichEditDocumentUnit::Centimeter;
  // Obtains properties of the paragraph where the caret is located
  AParagraphProperties = ADocument->BeginUpdateParagraphs(ADocument->Selection);
  AParagraphProperties->Alignment = TdxRichEditParagraphAlignment::Justify;
  AParagraphProperties->FirstLineIndentType = TdxRichEditParagraphFirstLineIndent::Indented;
  AParagraphProperties->FirstLineIndent := 2;
  ADocument->EndUpdateParagraphs(AParagraphProperties); // Applies the changes to the current paragraph

See Also

IdxRichEditSubDocument Interface

IdxRichEditSubDocument Members

dxRichEdit.NativeApi Unit