• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class Paragraph

Represents a paragraph and its runs, fields, links, and inline objects.

Inheritance
object
Node
CompositeNode
Paragraph
Implements
IEnumerable<Node>
IEnumerable
IParagraph
Inherited Members
CompositeNode.ChildNodes
CompositeNode.GetAllChildNodes()
CompositeNode.Count
CompositeNode.FirstChild
CompositeNode.HasChildNodes
CompositeNode.IsComposite
CompositeNode.LastChild
CompositeNode.GetEnumerator()
Node.Document
Node.NextSibling
Node.ParentNode
Node.PreviousSibling
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public class Paragraph : CompositeNode, IEnumerable<Node>, IEnumerable, IParagraph

Properties

CommentAnchors

Gets the comment anchor metadata associated with this paragraph.

Declaration
public List<CommentAnchorInfo> CommentAnchors { get; }
Property Value
Type Description
List<CommentAnchorInfo>

CommentRangeEndIds

Gets the identifiers marking the ends of comment ranges.

Declaration
public List<int> CommentRangeEndIds { get; }
Property Value
Type Description
List<int>

CommentRangeStartIds

Gets the identifiers marking the starts of comment ranges.

Declaration
public List<int> CommentRangeStartIds { get; }
Property Value
Type Description
List<int>

CommentReferenceIds

Gets the comment reference identifiers associated with this paragraph.

Declaration
public List<int> CommentReferenceIds { get; }
Property Value
Type Description
List<int>

ContentControls

Gets the content controls contained in this paragraph.

Declaration
public ContentControlCollection ContentControls { get; }
Property Value
Type Description
ContentControlCollection

EndnoteReferenceIds

Gets the endnote identifiers referenced by this paragraph.

Declaration
public List<int> EndnoteReferenceIds { get; }
Property Value
Type Description
List<int>

Fields

Gets the fields contained in this paragraph.

Declaration
public List<Field> Fields { get; }
Property Value
Type Description
List<Field>

FootnoteReferenceIds

Gets the footnote identifiers referenced by this paragraph.

Declaration
public List<int> FootnoteReferenceIds { get; }
Property Value
Type Description
List<int>

FormFieldsData

The form fields in this paragraph. Each entry corresponds to a complex field (fldChar Begin/Separate/End sequence) that has form field data (ffData).

Declaration
public List<FormFieldData> FormFieldsData { get; }
Property Value
Type Description
List<FormFieldData>

Hyperlinks

Gets the hyperlinks contained in this paragraph.

Declaration
public List<Hyperlink> Hyperlinks { get; }
Property Value
Type Description
List<Hyperlink>

NodeType

Gets the node type, which is always Paragraph.

Declaration
public override NodeType NodeType { get; }
Property Value
Type Description
NodeType
Overrides
Node.NodeType

OfficeMaths

Gets the Office Math equations embedded in this paragraph.

Declaration
public OfficeMathCollection OfficeMaths { get; }
Property Value
Type Description
OfficeMathCollection

ParagraphFormat

Gets the paragraph-level formatting.

Declaration
public ParagraphFormat ParagraphFormat { get; }
Property Value
Type Description
ParagraphFormat

ParagraphFormatRevision

Gets or sets the tracked revision for this paragraph's formatting.

Declaration
public ParagraphFormatRevision ParagraphFormatRevision { get; set; }
Property Value
Type Description
ParagraphFormatRevision

Revision

The tracked-change revision for this paragraph, or null. When RevisionType.Delete, the paragraph is marked as deleted (content joins with the following paragraph on accept).

Declaration
public Revision Revision { get; set; }
Property Value
Type Description
Revision

Runs

Gets the ordered text runs in this paragraph.

Declaration
public RunCollection Runs { get; }
Property Value
Type Description
RunCollection

Methods

AddCommentAnchor(int)

Adds a paragraph-level comment anchor for the specified comment identifier.

Declaration
public void AddCommentAnchor(int commentId)
Parameters
Type Name Description
int commentId

The comment identifier to anchor.

AppendBreak(BreakType)

Appends a line, page, or column break.

Declaration
public Paragraph AppendBreak(BreakType breakType)
Parameters
Type Name Description
BreakType breakType

The supported break type.

Returns
Type Description
Paragraph

This paragraph.

AppendChart(Chart, double, double)

Appends an embedded chart to this paragraph as an inline drawing.

Declaration
public Paragraph AppendChart(Chart chart, double widthCm = 15, double heightCm = 7.5)
Parameters
Type Name Description
Chart chart

The chart to embed.

double widthCm

Width of the chart in centimeters.

double heightCm

Height of the chart in centimeters.

Returns
Type Description
Paragraph

AppendEndnoteReference(int)

Appends a reference to an endnote.

Declaration
public Paragraph AppendEndnoteReference(int noteId)
Parameters
Type Name Description
int noteId

The non-negative endnote identifier.

Returns
Type Description
Paragraph

This paragraph.

AppendFloatingShape(AbstractShape, WrapType, RelativeHorizontalPosition, RelativeVerticalPosition, HorizontalAlignment, VerticalAlignment, bool, double?, double?)

Appends a floating (anchored) shape to this paragraph. Floating shapes are positioned independently of the text flow and are used for watermarks, background images, and other page-level overlays.

Declaration
public Paragraph AppendFloatingShape(AbstractShape shape, WrapType wrapType = WrapType.None, RelativeHorizontalPosition relHoriz = RelativeHorizontalPosition.Page, RelativeVerticalPosition relVert = RelativeVerticalPosition.Page, HorizontalAlignment horizAlign = HorizontalAlignment.Center, VerticalAlignment vertAlign = VerticalAlignment.Center, bool behindText = true, double? horizontalOffsetPoints = null, double? verticalOffsetPoints = null)
Parameters
Type Name Description
AbstractShape shape

The drawing shape to embed.

WrapType wrapType

Wrapping mode (use WrapType.None for watermarks).

RelativeHorizontalPosition relHoriz

Horizontal reference (use Page for watermarks).

RelativeVerticalPosition relVert

Vertical reference (use Page for watermarks).

HorizontalAlignment horizAlign

Horizontal alignment (use Center for watermarks).

VerticalAlignment vertAlign

Vertical alignment (use Center for watermarks).

bool behindText

When true the shape sits behind body text.

double? horizontalOffsetPoints

Optional horizontal offset from the selected horizontal reference, in points.

double? verticalOffsetPoints

Optional vertical offset from the selected vertical reference, in points.

Returns
Type Description
Paragraph

AppendFootnoteReference(int)

Appends a reference to a footnote.

Declaration
public Paragraph AppendFootnoteReference(int noteId)
Parameters
Type Name Description
int noteId

The non-negative footnote identifier.

Returns
Type Description
Paragraph

This paragraph.

AppendFormCheckBox(string)

Appends a check-box form field to this paragraph.

Declaration
public FormCheckBoxData AppendFormCheckBox(string name)
Parameters
Type Name Description
string name

The form field name.

Returns
Type Description
FormCheckBoxData

The created FormCheckBoxData for further customization.

AppendFormDropDown(string)

Appends a drop-down list form field to this paragraph.

Declaration
public FormDropDownData AppendFormDropDown(string name)
Parameters
Type Name Description
string name

The form field name.

Returns
Type Description
FormDropDownData

The created FormDropDownData for further customization.

AppendFormText(string, string)

Appends a text-input form field to this paragraph.

Declaration
public FormTextData AppendFormText(string name, string defaultText = "")
Parameters
Type Name Description
string name

The form field name.

string defaultText

The default text shown in the field (also used as the field result).

Returns
Type Description
FormTextData

The created FormTextData for further customization.

AppendOfficeMath(string)

Appends an inline Office Math equation to this paragraph.

Declaration
public OfficeMath AppendOfficeMath(string text)
Parameters
Type Name Description
string text

The equation text.

Returns
Type Description
OfficeMath

The newly created equation.

AppendOfficeMath(string, OfficeMathDisplayType)

Appends an Office Math equation with the requested display mode.

Declaration
public OfficeMath AppendOfficeMath(string text, OfficeMathDisplayType displayType)
Parameters
Type Name Description
string text

The equation text.

OfficeMathDisplayType displayType

The display mode.

Returns
Type Description
OfficeMath

The newly created equation.

AppendRun(string)

Appends a new run to the paragraph.

Declaration
public Run AppendRun(string text)
Parameters
Type Name Description
string text

Optional initial run text.

Returns
Type Description
Run

The newly appended run.

AppendShape(Shape)

Appends an inline drawing shape to the paragraph.

Declaration
public Paragraph AppendShape(Shape shape)
Parameters
Type Name Description
Shape shape

The shape to append.

Returns
Type Description
Paragraph

This paragraph.

AppendSignatureLine(SignatureLineOptions)

Appends a legacy VML signature line to this paragraph.

Declaration
public DocumentShape AppendSignatureLine(SignatureLineOptions options = null)
Parameters
Type Name Description
SignatureLineOptions options

The metadata used to initialize the signature line.

Returns
Type Description
DocumentShape

The newly created document shape.

AppendTableOfContents(string)

Appends a Table of Contents field to this paragraph. The field is marked dirty so that Word will generate the TOC entries when the document is opened. Set document.DocumentSettings.UpdateFields = true to ensure Word recalculates the field on load.

Declaration
public Paragraph AppendTableOfContents(string switches = " \\o \"1-3\" \\h \\z \\u")
Parameters
Type Name Description
string switches

Optional TOC switches appended to the instruction. Default is " \o "1-3" \h \z \u" (outline levels 1-3, hyperlinks, hide tab leaders, use outline levels).

Returns
Type Description
Paragraph

AppendText(string)

Appends text to the paragraph, creating a run when needed.

Declaration
public Paragraph AppendText(string text)
Parameters
Type Name Description
string text

The text to append.

Returns
Type Description
Paragraph

This paragraph.

AppendWordArt(string)

Appends a legacy VML WordArt text path to this paragraph.

Declaration
public DocumentShape AppendWordArt(string text)
Parameters
Type Name Description
string text

The text rendered along the VML path.

Returns
Type Description
DocumentShape

The newly created document shape.

GetText()

Gets the concatenated text of all runs in this paragraph.

Declaration
public string GetText()
Returns
Type Description
string

The paragraph text.

InsertRun(int, string)

Inserts a text run at the specified zero-based index.

Declaration
public Run InsertRun(int index, string text = null)
Parameters
Type Name Description
int index

The zero-based insertion index.

string text

The initial run text.

Returns
Type Description
Run

The inserted run.

RemoveCommentAnchor(int)

Removes the paragraph-level comment anchor for the specified comment identifier.

Declaration
public bool RemoveCommentAnchor(int commentId)
Parameters
Type Name Description
int commentId

The comment identifier to remove.

Returns
Type Description
bool

true when an anchor was removed.

Implements

IEnumerable<T>
IEnumerable
IParagraph
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX