Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

RtfParagraph

OfficeIMO.Rtf

Namespace
OfficeIMO.Rtf
Assembly
OfficeIMO.Rtf
Source revision
ba882f6b0d07 with working tree changes
Implements
IRtfCloneable IRtfBlock
Modifiers
sealed

Paragraph in an RTF document.

Inheritance

  • object
  • RtfParagraph

Usage

Explore 41 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 5

Constructors

public RtfParagraph() #

Methods

public RtfRun AddAnnotation(string referenceText, string noteText) #

Adds an annotation reference run with note text.

Parameters

referenceText string required
noteText string required

Returns

RtfRun
public RtfBookmarkMarker AddBookmarkEnd(string name) #

Adds a bookmark end marker at the current paragraph position.

Parameters

name string required
public RtfBookmarkMarker AddBookmarkStart(string name) #

Adds a bookmark start marker at the current paragraph position.

Parameters

name string required
public RtfBreak AddBreak(RtfBreakKind kind) #

Adds an explicit break at the current paragraph position.

Parameters

kind OfficeIMO.Rtf.RtfBreakKind required

Returns

RtfBreak
public RtfBreak AddColumnBreak() #

Adds a column break at the current paragraph position.

Returns

RtfBreak
public RtfGeneratedText AddCurrentDate(string? fallbackText = null) #

Adds a generated current date marker.

Parameters

fallbackText string? = null optional
public RtfGeneratedText AddCurrentDateAbbreviated(string? fallbackText = null) #

Adds a generated current date marker in abbreviated format.

Parameters

fallbackText string? = null optional
public RtfGeneratedText AddCurrentDateLong(string? fallbackText = null) #

Adds a generated current date marker in long format.

Parameters

fallbackText string? = null optional
public RtfGeneratedText AddCurrentTime(string? fallbackText = null) #

Adds a generated current time marker.

Parameters

fallbackText string? = null optional
public RtfRun AddEndnote(string referenceText, string noteText) #

Adds a superscript endnote reference run with note text.

Parameters

referenceText string required
noteText string required

Returns

RtfRun
public RtfField AddEquationField(string equationInstruction, string resultText) #

Adds a Word EQ equation field with cached visible fallback text.

Parameters

equationInstruction string required
resultText string required

Returns

RtfField
public RtfField AddField(string instruction) #

Adds an RTF field at the current paragraph position.

Parameters

instruction string required

Returns

RtfField
public RtfRun AddFootnote(string referenceText, string noteText) #

Adds a superscript footnote reference run with note text.

Parameters

referenceText string required
noteText string required

Returns

RtfRun
public RtfGeneratedText AddGeneratedText(RtfGeneratedTextKind kind, string? fallbackText = null) #

Adds a generated text marker at the current paragraph position.

Parameters

kind OfficeIMO.Rtf.RtfGeneratedTextKind required
fallbackText string? = null optional
public RtfImage AddImage(RtfImageFormat format, byte[] data) #

Adds a picture at the current paragraph position.

Parameters

format OfficeIMO.Rtf.RtfImageFormat required
data byte[] required

Returns

RtfImage
public RtfBreak AddLineBreak() #

Adds a line break at the current paragraph position.

Returns

RtfBreak
public RtfGeneratedText AddNoteReference(RtfNote note, string? fallbackText = null) #

Adds an automatic note reference marker and attaches the supplied note to it.

Parameters

note OfficeIMO.Rtf.RtfNote required
fallbackText string? = null optional
public RtfObject AddObject(RtfObjectKind kind = Unknown, byte[]? data = null) #

Adds an embedded or linked object at the current paragraph position.

Parameters

kind OfficeIMO.Rtf.RtfObjectKind = Unknown optional
data byte[]? = null optional

Returns

RtfObject
public RtfBreak AddPageBreak() #

Adds a page break at the current paragraph position.

Returns

RtfBreak
public RtfGeneratedText AddPageNumber(string? fallbackText = null) #

Adds a generated current page number marker.

Parameters

fallbackText string? = null optional
public RtfGeneratedText AddSectionNumber(string? fallbackText = null) #

Adds a generated current section number marker.

Parameters

fallbackText string? = null optional
public RtfShape AddShape() #

Adds a drawing shape at the current paragraph position.

Returns

RtfShape
public RtfBreak AddSoftLineBreak() #

Adds a soft line break at the current paragraph position.

Returns

RtfBreak
public RtfBreak AddSoftPageBreak() #

Adds a soft page break at the current paragraph position.

Returns

RtfBreak
public RtfTabStop AddTabStop(int positionTwips, RtfTabAlignment alignment = Left, RtfTabLeader leader = None) #

Adds a tab stop to the paragraph.

Parameters

positionTwips int required
alignment OfficeIMO.Rtf.RtfTabAlignment = Left optional
leader OfficeIMO.Rtf.RtfTabLeader = None optional

Returns

RtfTabStop
public RtfRun AddText(string text) #

Adds a text run.

Parameters

text string required

Returns

RtfRun
public RtfParagraph ClearListText() #

Clears fallback list marker text.

public int ReplaceText(string oldText, string newText, StringComparison comparison = Ordinal) #

Replaces text across adjacent runs. Replacement text inherits formatting from the run where each match begins; unaffected prefix and suffix runs keep their existing formatting.

Parameters

oldText string required
newText string required
comparison System.StringComparison = Ordinal optional

Returns

int
public RtfParagraph SetAdjustRightIndent(bool? enabled = true) #

Sets automatic right-indent adjustment for document-grid layouts.

Parameters

enabled bool? = true optional
public RtfParagraph SetAlignment(RtfTextAlignment alignment) #

Sets paragraph alignment.

Parameters

alignment OfficeIMO.Rtf.RtfTextAlignment required
public RtfParagraph SetBackgroundColor(int? colorIndex) #

Sets paragraph background shading to a one-based color table index.

Parameters

colorIndex int? required
public RtfParagraph SetBorder(RtfParagraphBorderSide side, RtfParagraphBorderStyle style, int? width = null, int? colorIndex = null) #

Sets paragraph border formatting for one side.

Parameters

side OfficeIMO.Rtf.RtfParagraphBorderSide required
style OfficeIMO.Rtf.RtfParagraphBorderStyle required
width int? = null optional
colorIndex int? = null optional
public RtfParagraph SetContextualSpacing(bool? enabled = true) #

Sets contextual paragraph spacing.

Parameters

enabled bool? = true optional
public RtfParagraph SetDirection(RtfTextDirection? direction) #

Sets explicit paragraph text direction.

Parameters

direction OfficeIMO.Rtf.RtfTextDirection? required
public RtfParagraph SetFrame(Action<RtfParagraphFrame> configure) #

Configures absolute positioning frame metadata for this paragraph.

Parameters

configure System.Action<OfficeIMO.Rtf.RtfParagraphFrame> required
public RtfParagraph SetIndentation(int? leftTwips = null, int? rightTwips = null, int? firstLineTwips = null) #

Sets paragraph indentation in twips.

Parameters

leftTwips int? = null optional
rightTwips int? = null optional
firstLineTwips int? = null optional
public RtfParagraph SetLegacyNumbering(Action<RtfLegacyNumbering> configure) #

Configures Word 6/95 legacy paragraph numbering metadata.

Parameters

configure System.Action<OfficeIMO.Rtf.RtfLegacyNumbering> required
public RtfParagraph SetLineSpacing(int? lineSpacingTwips, bool? multiple = null) #

Sets raw RTF paragraph line spacing controls.

Parameters

lineSpacingTwips int? required
multiple bool? = null optional
public RtfParagraph SetList(int listId = 1, int level = 0, RtfListKind kind = Bullet) #

Marks the paragraph as a list item.

Parameters

listId int = 1 optional
level int = 0 optional
kind OfficeIMO.Rtf.RtfListKind = Bullet optional
SetListText 2 overloads
public RtfParagraph SetListText(string text) #

Sets plain fallback list marker text emitted in a \listtext destination.

Parameters

text string required
public RtfParagraph SetListText(Action<RtfParagraph> configure) #

Configures rich fallback list marker content emitted in a \listtext destination.

Parameters

configure System.Action<OfficeIMO.Rtf.RtfParagraph> required
public RtfParagraph SetOutlineLevel(int? outlineLevel) #

Sets the paragraph outline level.

Parameters

outlineLevel int? required
public RtfParagraph SetPagination(bool? pageBreakBefore = null, bool? keepWithNext = null, bool? keepLinesTogether = null, bool? widowControl = null, bool? suppressLineNumbers = null, bool? autoHyphenation = null) #

Sets paragraph pagination controls.

Parameters

pageBreakBefore bool? = null optional
keepWithNext bool? = null optional
keepLinesTogether bool? = null optional
widowControl bool? = null optional
suppressLineNumbers bool? = null optional
autoHyphenation bool? = null optional
public RtfParagraph SetParagraphSpacing(int? beforeTwips = null, int? afterTwips = null, bool? beforeAuto = null, bool? afterAuto = null) #

Sets paragraph spacing before and after this paragraph.

Parameters

beforeTwips int? = null optional
afterTwips int? = null optional
beforeAuto bool? = null optional
afterAuto bool? = null optional
public RtfParagraph SetRevisionSaveId(int? id) #

Sets the paragraph revision save identifier represented by \pararsid.

Parameters

id int? required
public RtfParagraph SetShading(int? backgroundColorIndex, int? foregroundColorIndex = null, int? patternPercent = null, RtfShadingPattern pattern = None) #

Sets paragraph shading color and pattern metadata.

Parameters

backgroundColorIndex int? required
foregroundColorIndex int? = null optional
patternPercent int? = null optional
pattern OfficeIMO.Rtf.RtfShadingPattern = None optional
public RtfParagraph SetSnapToLineGrid(bool? enabled = true) #

Sets whether paragraph lines snap to the document line grid.

Parameters

enabled bool? = true optional
public RtfParagraph SetStyle(int styleId) #

Sets the paragraph style id.

Parameters

styleId int required
public string ToPlainText() #

Returns plain text for the paragraph.

Returns

string

Properties

public IReadOnlyList<RtfRun> Runs { get; } #

Paragraph runs.

public IReadOnlyList<IRtfInline> Inlines { get; } #

Paragraph inline content in original order, including non-text markers such as bookmarks.

public IReadOnlyList<RtfTabStop> TabStops { get; } #

Paragraph tab stops in RTF declaration order.

public RtfTextAlignment Alignment { get; set; } #

Paragraph alignment.

public RtfTextAlignment? DirectAlignment { get; set; } #

Authored Alignment override. Null inherits from the selected style; an explicit default clears that style value.

public RtfTextDirection? Direction { get; set; } #

Explicit paragraph text direction represented by \ltrpar or \rtlpar.

public int? StyleId { get; set; } #

Optional paragraph stylesheet id.

public int? ListId { get; set; } #

Optional list id for paragraphs bound to an RTF list override.

public int? ListDefinitionId { get; set; } #

Optional list definition id resolved through the list override table.

public int? ListLevel { get; set; } #

Optional zero-based list level.

public RtfListKind ListKind { get; set; } #

Basic list marker kind.

public RtfLegacyNumbering LegacyNumbering { get; private set; } #

Word 6/95 legacy paragraph numbering metadata from \pn* controls.

public RtfParagraph? ListText { get; private set; } #

Word list marker fallback text represented by a paragraph-level \listtext destination.

public int? LeftIndentTwips { get; set; } #

Left indentation in twips.

public int? RightIndentTwips { get; set; } #

Right indentation in twips.

public int? FirstLineIndentTwips { get; set; } #

First-line indentation in twips.

public int? SpaceBeforeTwips { get; set; } #

Space before paragraph in twips.

public int? SpaceAfterTwips { get; set; } #

Space after paragraph in twips.

public bool? SpaceBeforeAuto { get; set; } #

Whether space before the paragraph is automatically determined by the renderer.

public bool? SpaceAfterAuto { get; set; } #

Whether space after the paragraph is automatically determined by the renderer.

public int? LineSpacingTwips { get; set; } #

Raw RTF line spacing value from \sl.

public bool? LineSpacingMultiple { get; set; } #

Whether \sl is interpreted as multiple line spacing by \slmult. Null means not specified.

public int? BackgroundColorIndex { get; set; } #

One-based color table index used by paragraph background shading.

public int? ShadingForegroundColorIndex { get; set; } #

One-based color table index used by paragraph pattern foreground shading.

public int? ShadingPatternPercent { get; set; } #

Raw RTF \shading value, where 10000 represents 100 percent.

public RtfShadingPattern ShadingPattern { get; set; } #

Named RTF shading pattern.

public RtfParagraphBorder TopBorder { get; private set; } #

Top paragraph border.

public RtfParagraphBorder LeftBorder { get; private set; } #

Left paragraph border.

public RtfParagraphBorder BottomBorder { get; private set; } #

Bottom paragraph border.

public RtfParagraphBorder RightBorder { get; private set; } #

Right paragraph border.

public bool PageBreakBefore { get; set; } #

Whether a page break should be emitted before this paragraph.

public bool? DirectPageBreakBefore { get; set; } #

Authored PageBreakBefore override. Null inherits from the selected style; an explicit default clears that style value.

public bool KeepWithNext { get; set; } #

Whether this paragraph should stay on the same page as the following paragraph.

public bool? DirectKeepWithNext { get; set; } #

Authored KeepWithNext override. Null inherits from the selected style; an explicit default clears that style value.

public bool KeepLinesTogether { get; set; } #

Whether all lines in this paragraph should stay together on the same page.

public bool? DirectKeepLinesTogether { get; set; } #

Authored KeepLinesTogether override. Null inherits from the selected style; an explicit default clears that style value.

public bool SuppressLineNumbers { get; set; } #

Whether line numbering is suppressed for this paragraph.

public bool? DirectSuppressLineNumbers { get; set; } #

Authored SuppressLineNumbers override. Null inherits from the selected style; an explicit default clears that style value.

public bool? AutoHyphenation { get; set; } #

Paragraph-level automatic hyphenation override represented by \hyphpar.

public bool? ContextualSpacing { get; set; } #

Whether contextual paragraph spacing is explicitly enabled or disabled.

public bool? AdjustRightIndent { get; set; } #

Whether the right indent is automatically adjusted when a document grid is defined.

public bool? SnapToLineGrid { get; set; } #

Whether paragraph lines snap to the document line grid.

public bool? WidowControl { get; set; } #

Explicit paragraph widow/orphan control. Null means not specified.

public int? OutlineLevel { get; set; } #

Optional paragraph outline level.

public int? RevisionSaveId { get; set; } #

Paragraph revision save identifier represented by \pararsid.

public RtfParagraphFrame Frame { get; private set; } #

Absolute positioning, text wrapping, and drop-cap metadata for this paragraph.