Skip to main content

Paragraph Class

A document paragraph.

Namespace: DevExpress.XtraRichEdit.API.Native

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

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

Declaration

[ComVisible(true)]
public abstract class Paragraph

Remarks

Access Paragraphs

The ParagraphCollection contains all document paragraphs. Use the SubDocument.Paragraphs property to access a specific paragraph by its index. The Section.Paragraphs property obtains a collection of paragraphs in a specific document section. Call the ReadOnlyParagraphCollection.Get method to retrieve a paragraph related to a specific range.

Format Paragraphs

Yoy can format paragraphs directly or use document styles. Refer to the following topic for more examples on how to format paragraphs:

Read Tutorial: Text Formatting

Example

The code sample below appends a paragraph and inserts a paragraph at the start of the second section:

using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer())
{
  wordProcessor.LoadDocument("FirstLook.docx");
  Document document = wordProcessor.Document;

  // Start the document update:
  document.BeginUpdate();

  // Append a paragraph:
  Paragraph appendedParagraph = document.Paragraphs.Append();
  document.InsertText(appendedParagraph.Range.Start, "Appended paragraph");

  // Insert a paragraph at the start of the second section:
  Paragraph paragraph =
     document.Paragraphs.Insert(document.Sections[1].Range.Start);
  DocumentPosition position =
     document.Paragraphs[paragraph.Index - 1].Range.Start;
  document.InsertText(position, "Inserted paragraph");

  // Finalize the document update:
  document.EndUpdate();
}

Inheritance

Object
Paragraph
See Also