Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Paragraph Class

A document paragraph.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

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();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Paragraph class.

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.

Inheritance

Object
Paragraph
See Also