Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordParagraph

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
0eef6a5756b9 with working tree changes
Implements
IEquatable<WordParagraph>

Represents a paragraph within a Word document.

Inheritance

Usage

Explore 234 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.

Returned or exposed by 190

Accepted by parameters 44

Constructors

public WordParagraph(WordDocument? document = null, bool newParagraph = true, bool newRun = true) #

Initializes a new paragraph.

Parameters

document OfficeIMO.Word.WordDocument? = null optional
Parent document.
newParagraph bool = true optional
Create a new paragraph element.
newRun bool = true optional
Create a new run inside the paragraph.

Methods

public WordBookmark AddBookmark(string bookmarkName) #

Add bookmark to a word document proceeding from the paragraph this was called on.

Parameters

bookmarkName string required
The name of the bookmark.

Returns

WordBookmark The created object.
public WordParagraph AddBreak(WordBreakType? breakType = null) #

Add Break to the paragraph. By default it adds soft break (SHIFT+ENTER)

Parameters

breakType OfficeIMO.Word.WordBreakType? = null optional
Optional argument to add a specific type of break.

Returns

WordParagraph The new WordParagraph that this method creates.
AddChart 3 overloads
public WordChart AddChart(string title = "", bool roundedCorners = false, OfficeLength? width = null, OfficeLength? height = null) #

Adds the chart to the document. The type of chart is determined by the type of data passed in. You can use multiple: .AddBar() to add a bar chart .AddLine() to add a line chart .AddPie() to add a pie chart .AddArea() to add an area chart .AddScatter() to add a scatter chart .AddRadar() to add a radar chart .AddBar3D() to add a 3-D bar chart. .AddPie3D() to add a 3-D pie chart. .AddLine3D() to add a 3-D line chart. You can't mix and match the types of charts, except bar and line which can coexist in a combo chart.

Parameters

title string = "" optional
The title.
roundedCorners bool = false optional
if set to true [rounded corners].
width OfficeIMO.OfficeLength? = null optional
The width.
height OfficeIMO.OfficeLength? = null optional
The height.

Returns

WordChart WordChart
public WordChart AddChart(OfficeChartType chartKind, OfficeChartData data) #

Adds an editable native chart with the format's default title, size and placement.

Parameters

chartKind OfficeIMO.OfficeChartType required
data OfficeIMO.Drawing.OfficeChartData required

Returns

WordChart
public WordChart AddChart(OfficeChartType chartKind, OfficeChartData data, OfficeChartOptions? options) #

Inserts an editable chart with an embedded worksheet after this paragraph.

Parameters

chartKind OfficeIMO.OfficeChartType required
Default chart family for series without their own render kind.
data OfficeIMO.Drawing.OfficeChartData required
Shared chart categories, series, and appearance.
options OfficeIMO.OfficeChartOptions? required
Optional title, physical size and Word frame options. The default size is 600 by 600 pixels.

Returns

WordChart The created chart.
public WordCheckBox AddCheckBox(bool isChecked = false, string? alias = null, string? tag = null) #

Adds a checkbox content control to the paragraph.

Parameters

isChecked bool = false optional
Initial checked state.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.

Returns

WordCheckBox The created WordCheckBox instance.
public WordField AddCitation(string sourceTag) #

Adds a citation field referencing the specified source tag.

Parameters

sourceTag string required
Tag of the bibliographic source.

Returns

WordField The created object.
public WordComboBox AddComboBox(IEnumerable<string> items, string? alias = null, string? tag = null, string? defaultValue = null) #

Adds a combo box content control to the paragraph.

Parameters

items System.Collections.Generic.IEnumerable<string> required
Items to include in the combo box.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.
defaultValue string? = null optional
Optional default value to display; must match one of the provided items.

Returns

WordComboBox The created WordComboBox instance.
public WordChart AddComboChart(string title = "", bool roundedCorners = false, OfficeLength? width = null, OfficeLength? height = null) #

Creates a chart ready for combining bar and line series. Use WordChart.AddCategories to supply category labels and then call WordChart.AddBar or WordChart.AddLine to add data. AddCategories must be called before adding any series so that both chart types share the same axes.

Parameters

title string = "" optional
roundedCorners bool = false optional
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional

Returns

WordChart
public WordComment AddComment(string author, string initials, string comment) #

Add a comment to paragraph

Parameters

author string required
The name of the commenting author
initials string required
The initials of the commenting author
comment string required
The comment text
public WordField AddCrossReference(string referenceId, WordCrossReferenceType type) #

Adds a cross reference field to the paragraph.

Parameters

referenceId string required
Bookmark or heading identifier.
type OfficeIMO.Word.WordCrossReferenceType required
Type of reference.

Returns

WordField The created object.
public WordDatePicker AddDatePicker(DateTime? date = null, string? alias = null, string? tag = null) #

Adds a date picker content control to the paragraph.

Parameters

date System.DateTime? = null optional
Initial date value.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.

Returns

WordDatePicker The created WordDatePicker instance.
public WordParagraph AddDeletedText(string text, string author, DateTime? date = null) #

Inserts revision text marked as deleted.

Parameters

text string required
Text to delete.
author string required
Revision author.
date System.DateTime? = null optional
Revision date. Uses current date when null.

Returns

WordParagraph The current WordParagraph instance.
public WordDropDownList AddDropDownList(IEnumerable<string> items, string? alias = null, string? tag = null) #

Adds a dropdown list content control to the paragraph.

Parameters

items System.Collections.Generic.IEnumerable<string> required
Items to include in the list.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.

Returns

WordDropDownList The created WordDropDownList instance.
AddEmbeddedObject 2 overloads
public WordEmbeddedObject AddEmbeddedObject(string filePath, string imageFilePath, OfficeLength? width = null, OfficeLength? height = null) #

Embeds an object with a preview image.

Parameters

filePath string required
Path to the object file.
imageFilePath string required
Preview image path.
width OfficeIMO.OfficeLength? = null optional
Optional physical width; defaults to 64.8 points.
height OfficeIMO.OfficeLength? = null optional
Optional physical height; defaults to 64.8 points.

Returns

WordEmbeddedObject The created embedded object.
public WordEmbeddedObject AddEmbeddedObject(string filePath, WordEmbeddedObjectOptions options) #

Embeds an object with custom options.

Parameters

filePath string required
Path to the object file.
options OfficeIMO.Word.WordEmbeddedObjectOptions required
Embedding options.

Returns

WordEmbeddedObject The created embedded object.
public WordEndNote AddEndNote(string text) #

Add an end note to the document for this paragraph.

Parameters

text string required
The text of the end note.

Returns

WordEndNote The end note.
AddEquation 2 overloads
public WordEquation AddEquation(OfficeMathExpression expression) #

Adds an inline editable Word equation authored with the reusable OfficeIMO math model.

Parameters

expression OfficeIMO.Drawing.OfficeMathExpression required
public WordEquation AddEquation(string omml) #

Adds a mathematical equation represented as OMML XML.

Parameters

omml string required
Office Math Markup Language (OMML) fragment.

Returns

WordEquation The created object.
AddField 3 overloads
public WordField AddField(WordFieldType wordFieldType, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, List<string>? parameters = null) #

Add fields to a word document proceeding from the paragraph this is called on.

Parameters

wordFieldType OfficeIMO.Word.WordFieldType required
The type of field to add.
wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null optional
The format of the field to add.
customFormat string? = null optional
Custom format string for date or time fields.
advanced bool = false optional
Use advanced field representation.
parameters System.Collections.Generic.List<string>? = null optional
Usages like parameters = new List< String>{ @"\d 'Default'", @"\c" }; Also see available List of switches per field code: https://support.microsoft.com/en-us/office/list-of-field-codes-in-word-1ad6d91a-55a7-4a8d-b535-cf7888659a51

Returns

WordField The created object.
public WordField AddField(WordFieldCode fieldCode, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false) #

Add a field represented by a WordFieldCode.

Parameters

fieldCode OfficeIMO.Word.WordFieldCode required
Field code instance describing instructions and switches.
wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null optional
Optional field format.
customFormat string? = null optional
Custom format string for date or time fields.
advanced bool = false optional
Use advanced field representation.

Returns

WordField The created object.
public WordField AddField(WordFieldBuilder builder, bool advanced = false) #

Adds a field constructed using WordFieldBuilder.

Parameters

builder OfficeIMO.Word.WordFieldBuilder required
Field builder instance.
advanced bool = false optional
Use advanced field representation.

Returns

WordField The created object.
public WordFootNote AddFootNote(string text) #

Add a foot note for the current paragraph.

Parameters

text string required
The text of the note.

Returns

WordFootNote The footnote.

Exceptions

  • InvalidOperationException – The paragraph is in a header or footer.
public WordParagraph AddFormattedText(string text, bool bold = false, bool italic = false, WordUnderlineStyle? underline = null) #

Adds formatted text to the paragraph and applies basic run properties.

Parameters

text string required
Text to insert.
bold bool = false optional
Whether the text should be bold.
italic bool = false optional
Whether the text should be italic.
underline OfficeIMO.Word.WordUnderlineStyle? = null optional
Optional underline style.

Returns

WordParagraph The run containing the formatted text.
public WordParagraph AddHorizontalLine(WordBorderStyle? lineType = null, OfficeColor? color = null, uint size = 12, uint space = 1) #

Add horizontal line (sometimes known as horizontal rule) to document proceeding from the paragraph that this is called on.

Parameters

lineType OfficeIMO.Word.WordBorderStyle? = null optional
The type of the line.
color OfficeIMO.OfficeColor? = null optional
The color of the line
size uint = 12 optional
The size of the line.
space uint = 1 optional
The space the line takes up.

Returns

WordParagraph The new Paragraph after the line.
AddHyperLink 2 overloads
AddImage 3 overloads
public WordImage AddImage(string path, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null) #

Embeds an image file and returns its editable occurrence.

Parameters

path string required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
options OfficeIMO.Word.WordImageOptions? = null optional

Returns

WordImage
public WordImage AddImage(Stream stream, string fileName, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null) #

Embeds an image stream without disposing the caller's stream.

Parameters

stream System.IO.Stream required
fileName string required
width OfficeIMO.OfficeLength? = null optional
height OfficeIMO.OfficeLength? = null optional
options OfficeIMO.Word.WordImageOptions? = null optional

Returns

WordImage
public WordImage AddImage(Uri uri, OfficeLength width, OfficeLength height, WordImageOptions? options = null) #

Adds a linked external image. The image remains an external relationship.

Parameters

uri System.Uri required
width OfficeIMO.OfficeLength required
height OfficeIMO.OfficeLength required
options OfficeIMO.Word.WordImageOptions? = null optional

Returns

WordImage
public WordParagraph AddInsertedText(string text, string author, DateTime? date = null) #

Inserts revision text marked as added.

Parameters

text string required
Text to insert.
author string required
Revision author.
date System.DateTime? = null optional
Revision date. Uses current date when null.

Returns

WordParagraph The current WordParagraph instance.
public WordLine AddLine(OfficeLength startX, OfficeLength startY, OfficeLength endX, OfficeLength endY, OfficeColor? color = null, OfficeLength? strokeWeight = null) #

Adds a VML line and returns the created line.

Parameters

startX OfficeIMO.OfficeLength required
Start X coordinate.
startY OfficeIMO.OfficeLength required
Start Y coordinate.
endX OfficeIMO.OfficeLength required
End X coordinate.
endY OfficeIMO.OfficeLength required
End Y coordinate.
color OfficeIMO.OfficeColor? = null optional
Stroke color; black when omitted.
strokeWeight OfficeIMO.OfficeLength? = null optional
Stroke thickness; one point when omitted.

Returns

WordLine
public WordList AddList(WordListStyle style) #

Add a list after this paragraph.

Parameters

style OfficeIMO.Word.WordListStyle required
The style of this list.

Returns

WordList The new list.
public WordParagraph AddPageNumber(bool includeTotalPages = false, WordFieldFormat? format = null, string separator = " of ") #

Adds a page number field to the paragraph.

Parameters

includeTotalPages bool = false optional
If true adds a NUMPAGES field preceded by text " of ".
format OfficeIMO.Word.WordFieldFormat? = null optional
Optional field format to apply.
separator string = " of " optional
Text inserted between the current page and total pages fields.

Returns

WordParagraph The paragraph that this was called on.
AddParagraph 2 overloads
public WordParagraph AddParagraph(WordParagraph? wordParagraph = null) #

Add paragraph right after existing paragraph. This can be useful to add empty lines, or moving cursor to next line

Parameters

wordParagraph OfficeIMO.Word.WordParagraph? = null optional
Optional WordParagraph to insert after the given WordParagraph instead of at the end of the document.

Returns

WordParagraph The inserted WordParagraph.
public WordParagraph AddParagraph(string text) #

Add a paragraph with the given text to the end of the document.

Parameters

text string required
The text to fill the paragraph with.

Returns

WordParagraph The appended WordParagraph.
AddParagraphAfterSelf 2 overloads
public WordParagraph AddParagraphAfterSelf() #

Insert a new paragraph after the WordParagraph AddParagraphAfterSelf is called on in the document.

Returns

WordParagraph The inserted WordParagraph
public WordParagraph AddParagraphAfterSelf(WordSection section, WordParagraph? paragraph = null) #

Add paragraph after self but by allowing to specify section

Parameters

section OfficeIMO.Word.WordSection required
The section to add the paragraph to. When paragraph is given this has no effect.
paragraph OfficeIMO.Word.WordParagraph? = null optional
The optional paragraph to add the paragraph to.

Returns

WordParagraph The new WordParagraph
public WordParagraph AddParagraphBeforeSelf() #

Add a paragraph before the paragraph that AddParagraphBeforeSelf was called on.

Returns

WordParagraph The inserted paragraph
public WordPictureControl AddPictureControl(string filePath, OfficeLength? width = null, OfficeLength? height = null, string? alias = null, string? tag = null) #

Adds a picture content control containing an image to the paragraph.

Parameters

filePath string required
Image file path.
width OfficeIMO.OfficeLength? = null optional
Optional physical width of the image.
height OfficeIMO.OfficeLength? = null optional
Optional physical height of the image.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.

Returns

WordPictureControl The created WordPictureControl instance.
public WordRepeatingSection AddRepeatingSection(string? sectionTitle = null, string? alias = null, string? tag = null) #

Adds a repeating section content control to the paragraph.

Parameters

sectionTitle string? = null optional
Optional title of the repeating section.
alias string? = null optional
Optional alias for the control.
tag string? = null optional
Optional tag for the control.

Returns

WordRepeatingSection The created WordRepeatingSection instance.
AddShape 2 overloads
public WordShape AddShape(OfficeLength width, OfficeLength height, OfficeColor? fillColor = null) #

Adds a VML rectangle to the paragraph and returns the created shape.

Parameters

width OfficeIMO.OfficeLength required
Rectangle width.
height OfficeIMO.OfficeLength required
Rectangle height.
fillColor OfficeIMO.OfficeColor? = null optional
Fill color; white when omitted.

Returns

WordShape
public WordShape AddShape(WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null, OfficeColor? strokeColor = null, OfficeLength? strokeWeight = null, double arcSize = 0.25) #

Adds a VML shape to the paragraph and returns the created shape.

Parameters

shapeType OfficeIMO.Word.WordShapeType required
Type of shape to create.
width OfficeIMO.OfficeLength required
Width, or the line end X coordinate.
height OfficeIMO.OfficeLength required
Height, or the line end Y coordinate.
fillColor OfficeIMO.OfficeColor? = null optional
Fill color; white when omitted.
strokeColor OfficeIMO.OfficeColor? = null optional
Outline color; black when omitted.
strokeWeight OfficeIMO.OfficeLength? = null optional
Outline thickness; one point when omitted.
arcSize double = 0.25 optional
Dimensionless corner roundness fraction.

Returns

WordShape
AddShapeDrawing 2 overloads
public WordShape AddShapeDrawing(WordShapeType shapeType, OfficeLength width, OfficeLength height) #

Adds an inline DrawingML shape and returns the created shape.

Parameters

shapeType OfficeIMO.Word.WordShapeType required
width OfficeIMO.OfficeLength required
height OfficeIMO.OfficeLength required

Returns

WordShape
public WordShape AddShapeDrawing(WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeLength left, OfficeLength top) #

Adds a DrawingML shape anchored at an absolute position on the page.

Parameters

shapeType OfficeIMO.Word.WordShapeType required
width OfficeIMO.OfficeLength required
height OfficeIMO.OfficeLength required
left OfficeIMO.OfficeLength required
top OfficeIMO.OfficeLength required

Returns

WordShape
AddShapeGroup 2 overloads
public WordShapeGroup AddShapeGroup(IEnumerable<WordShapeGroupItem> items) #

Adds an inline native DrawingML group of bounded preset shapes.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordShapeGroupItem> required
public WordShapeGroup AddShapeGroup(IEnumerable<WordShapeGroupItem> items, OfficeLength left, OfficeLength top) #

Adds a native DrawingML shape group anchored at page-relative physical offsets.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordShapeGroupItem> required
left OfficeIMO.OfficeLength required
top OfficeIMO.OfficeLength required
public WordSmartArt AddSmartArt(WordSmartArtType type) #

Inserts a SmartArt diagram at the current position.

Parameters

type OfficeIMO.Word.WordSmartArtType required
Layout of SmartArt to create.

Returns

WordSmartArt The created WordSmartArt.
public WordStructuredDocumentTag AddStructuredDocumentTag(string text = "", string? alias = null, string? tag = null) #

Adds a simple content control (structured document tag) to the paragraph.

Parameters

text string = "" optional
Initial text of the control.
alias string? = null optional
Optional alias for the content control.
tag string? = null optional
Optional tag for the content control.
public WordParagraph AddTab() #

Adds a Tab to a paragraph

Returns

WordParagraph The paragraph this is called on.
public WordTable AddTableAfter(int rows, int columns, WordTableStyle tableStyle = TableGrid) #

Add a table after this paragraph and return the table.

Parameters

rows int required
The number of rows in the table.
columns int required
The number of columns in the table.
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optional
The optional style to be applied to the new table, defaults to TableGrid.

Returns

WordTable The new added table.
public WordTable AddTableBefore(int rows, int columns, WordTableStyle tableStyle = TableGrid) #

Add a table before this paragraph and return the table.

Parameters

rows int required
The number of rows in this table
columns int required
The number of columns in this table
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optional
The style of the table being added.

Returns

WordTable The new added table.
public WordTabStop AddTabStop(OfficeLength position, WordTabAlignment? alignment = null, WordTabLeader? leader = null) #

Provides ability for configuration of Tabs in a paragraph by adding one or more TabStops

Parameters

position OfficeIMO.OfficeLength required
The signed tab position, rounded to the nearest twip.
alignment OfficeIMO.Word.WordTabAlignment? = null optional
The optional alignment for the tabs.
leader OfficeIMO.Word.WordTabLeader? = null optional
The optional rune to use before the tabs.

Returns

WordTabStop The added tabs.
public WordParagraph AddText(string? text) #

Add a text to existing paragraph

Parameters

text string? required
The text to be added to the paragraph.

Returns

WordParagraph The paragraph containing the new text.
public WordTextBox AddTextBox(string text, WordImageTextWrapping wrapTextImage) #

Add a text box to the document.

Parameters

text string required
The text inside the text box.
wrapTextImage OfficeIMO.Word.WordImageTextWrapping required
The text image wrapping settings.
public WordTextBox AddTextBoxVml(string text) #

Adds a legacy VML text box to the paragraph.

Parameters

text string required
public WordParagraph ClearTabStops() #

Removes this paragraph's explicit tab stops, leaving inherited defaults unchanged.

Equals 2 overloads
public bool Equals(WordParagraph? other) #

Determines whether the specified WordParagraph is equal to the current instance.

Parameters

other OfficeIMO.Word.WordParagraph? required
The paragraph to compare with the current instance.

Returns

bool true if the paragraphs are equal; otherwise, false.
public override bool Equals(object? obj) #

Determines whether the specified object is equal to the current instance.

Parameters

obj object? required
The object to compare with the current instance.

Returns

bool true if the objects are equal; otherwise, false.
public OfficeLength GetContentWidth() #

Estimates the authored content width available to an inline drawing in this paragraph as a physical length.

Returns

OfficeLength A positive width after the containing cell or section geometry and direct paragraph indents.

Exceptions

  • InvalidOperationException – The paragraph is detached, belongs to an unsupported text box, has ambiguous story geometry, or its margins and indents leave no positive content width.
public IEnumerable<WordFormattedRun> GetFormattedRuns() #

Enumerates this paragraph's text and image runs with reader-facing formatting metadata.

Returns

IEnumerable<WordFormattedRun> Formatted runs in document order.
public override int GetHashCode() #

Serves as the default hash function.

Returns

int A hash code for the current object.
public WordListStyle? GetListStyle() #

Gets the list style when this paragraph is part of a list.

GetRange 2 overloads
public WordRange GetRange() #

Returns a range covering all visible text of the paragraph that contains this element.

Returns

WordRange The paragraph range.
public WordRange GetRange(int start, int length) #

Returns a range of the visible text of the paragraph that contains this element.

Parameters

start int required
Zero-based offset from the start of the paragraph text, counting all of its runs.
length int required
Number of characters; zero gives an empty range that marks a position.

Returns

WordRange The range.
public IEnumerable<WordParagraph> GetRuns() #

Enumerates visible runs in paragraph order, including cached simple-field results and hyperlink runs.

Returns

IEnumerable<WordParagraph>
public static bool op_Equality(WordParagraph? left, WordParagraph? right) #

Determines whether two WordParagraph instances are equal.

Parameters

left OfficeIMO.Word.WordParagraph? required
The left-hand instance.
right OfficeIMO.Word.WordParagraph? required
The right-hand instance.

Returns

bool true if the instances are equal; otherwise, false.
public static bool op_Inequality(WordParagraph? left, WordParagraph? right) #

Determines whether two WordParagraph instances are not equal.

Parameters

left OfficeIMO.Word.WordParagraph? required
The left-hand instance.
right OfficeIMO.Word.WordParagraph? required
The right-hand instance.

Returns

bool true if the instances are not equal; otherwise, false.
public void Remove() #

Remove the paragraph from WordDocument

Exceptions

  • InvalidOperationException
public void RemoveCheckBox() #

Removes the checkbox from the paragraph.

public WordParagraph SetAlignment(WordParagraphAlignment alignment) #

Sets the paragraph alignment.

Parameters

alignment OfficeIMO.Word.WordParagraphAlignment required
Alignment value.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetBackgroundColor(OfficeColor color) #

Applies an exact background (run shading fill) color to the current text run.

Parameters

color OfficeIMO.OfficeColor required
The background color.

Returns

WordParagraph The current paragraph or run wrapper.
public WordParagraph SetBold(bool isBold = true) #

Sets the WordParagraph.Bold property.

Parameters

isBold bool = true optional
Whether the text should be bold.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetCapsStyle(WordCapsStyle capsStyle) #

Sets the capitalization style for the text.

Parameters

capsStyle OfficeIMO.Word.WordCapsStyle required
Capitalization style.

Returns

WordParagraph The current paragraph instance.
SetCharacterStyle 2 overloads
public WordParagraph SetCharacterStyle(WordStyle style) #

Applies a character style defined in this paragraph's document to the run.

Parameters

style OfficeIMO.Word.WordStyle required
A character style from WordDocument.Styles.

Returns

WordParagraph The current paragraph instance.

Exceptions

  • ArgumentException – The style is not a character style of this document.
public WordParagraph SetCharacterStyle(WordCharacterStyles style) #

Sets the character style for the run.

Parameters

style OfficeIMO.Word.WordCharacterStyles required
Character style to apply.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetCharacterStyleId(string styleId) #

Sets the character style by identifier.

Parameters

styleId string required
The style identifier.

Returns

WordParagraph The current paragraph instance.
public void SetCheckBoxValue(bool value) #

Sets the checked state of the paragraph's checkbox.

Parameters

value bool required
New checked state.
public WordParagraph SetColor(OfficeColor color) #

Sets the text color using OfficeColor.

Parameters

color OfficeIMO.OfficeColor required
The color to apply.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetDoubleStrikethrough(bool doubleStrikethrough = true) #

Enables or disables double strikethrough on the text.

Parameters

doubleStrikethrough bool = true optional
Whether the text should be double struck.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetEmboss(bool isEmboss = true) #

Enables or disables emboss effect on the text.

Parameters

isEmboss bool = true optional
Whether the text should be embossed.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetFontFamily(string fontFamily) #

Sets the font family for the text.

Parameters

fontFamily string required
Name of the font family.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetFontSize(OfficeLength fontSize) #

Sets the font size for the text.

Parameters

fontSize OfficeIMO.OfficeLength required
Font size in points.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetHighlight(WordHighlightColor highlight) #

Sets the highlight color for the text.

Parameters

highlight OfficeIMO.Word.WordHighlightColor required
Highlight color.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetItalic(bool isItalic = true) #

Sets the WordParagraph.Italic property.

Parameters

isItalic bool = true optional
Whether the text should be italic.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetLanguage(string language) #

Sets the language for the text run.

Parameters

language string required
Language tag, such as en-US or pl-PL.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetOutline(bool isOutline = true) #

Enables or disables outline effect on the text.

Parameters

isOutline bool = true optional
Whether the text should be outlined.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetShadow(bool isShadow = true) #

Enables or disables shadow effect on the text.

Parameters

isShadow bool = true optional
Whether the text should have a shadow.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetSmallCaps(bool isSmallCaps = true) #

Enables or disables small caps formatting on the text.

Parameters

isSmallCaps bool = true optional
Whether the text should use small caps.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetSpacing(OfficeLength? spacing) #

Sets the character spacing for the text.

Parameters

spacing OfficeIMO.OfficeLength? required
Signed character spacing, or null to remove the local value.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetStrikethrough(bool strikethrough = true) #

Enables or disables single strikethrough on the text.

Parameters

strikethrough bool = true optional
Whether the text should be struck through.

Returns

WordParagraph The current paragraph instance.
SetStyle 2 overloads
public WordParagraph SetStyle(WordParagraphStyles style) #

Sets the paragraph style.

Parameters

style OfficeIMO.Word.WordParagraphStyles required
The style to apply.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetStyle(WordStyle style) #

Applies a paragraph style defined in this paragraph's document.

Parameters

style OfficeIMO.Word.WordStyle required
A paragraph style from WordDocument.Styles.

Returns

WordParagraph The current paragraph instance.

Exceptions

  • ArgumentException – The style is not a paragraph style of this document.
public WordParagraph SetStyleId(string styleId) #

Sets the paragraph style by identifier.

Parameters

styleId string required
The style identifier.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetSubscript() #

Set the text as subscript

public WordParagraph SetSuperscript() #

Set the text as superscript

public WordParagraph SetText(string text) #

Sets the paragraph text.

Parameters

text string required
The text content.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetUnderline(WordUnderlineStyle underline) #

Sets the underline style for the text.

Parameters

underline OfficeIMO.Word.WordUnderlineStyle required
Underline style.

Returns

WordParagraph The current paragraph instance.
public WordParagraph SetVerticalTextAlignment(WordVerticalTextPosition? verticalPositionValue) #

Set the vertical text alignment

Parameters

verticalPositionValue OfficeIMO.Word.WordVerticalTextPosition? required
public WordParagraph TransformTextCase(OfficeTextCase textCase, CultureInfo? culture = null) #

Changes the stored run text casing while preserving run formatting.

Parameters

textCase OfficeIMO.Drawing.OfficeTextCase required
Casing transformation to apply.
culture System.Globalization.CultureInfo? = null optional
Culture used for casing. The current culture is used when omitted.

Returns

WordParagraph The current paragraph instance.

Properties

public WordBreak? PageBreak { get; } #

Get PageBreaks within Paragraph

public WordBreak? Break { get; } #

Get Breaks within Paragraph

public WordTabChar? Tab { get; } #

Gets the WordTabChar representing a tab character in the current run, or null if none is present.

public bool IsTab { get; } #

Gets a value indicating whether the run within the paragraph contains a tab character.

public List<WordTabStop> TabStops { get; } #

Gets all tab stops defined on the paragraph.

public int? CharacterScale { get; set; } #

Gets or sets the directly authored character width as a percentage between 1 and 600. A value of 100 restores normal width; null removes the direct value and restores style inheritance. Character height and character spacing are independent of this setting.

public WordStructuredDocumentTag? StructuredDocumentTag { get; } #

Gets the structured document tag contained in this paragraph, if present.

public WordCheckBox? CheckBox { get; } #

Gets the checkbox contained in this paragraph, if present.

public WordDatePicker? DatePicker { get; } #

Gets the date picker contained in this paragraph, if present.

public WordDropDownList? DropDownList { get; } #

Gets the dropdown list contained in this paragraph, if present.

public WordComboBox? ComboBox { get; } #

Gets the combo box contained in this paragraph, if present.

public WordPictureControl? PictureControl { get; } #

Gets the picture content control contained in this paragraph, if present.

public WordRepeatingSection? RepeatingSection { get; } #

Gets the repeating section contained in this paragraph, if present.

public bool IsStructuredDocumentTag { get; } #

Gets a value indicating whether the paragraph holds a structured document tag.

public bool IsCheckBox { get; } #

Gets a value indicating whether the paragraph contains a checkbox control.

public bool IsDatePicker { get; } #

Gets a value indicating whether the paragraph contains a date picker control.

public bool IsDropDownList { get; } #

Gets a value indicating whether the paragraph contains a dropdown list control.

public bool IsComboBox { get; } #

Gets a value indicating whether the paragraph contains a combo box control.

public bool IsPictureControl { get; } #

Gets a value indicating whether the paragraph contains a picture control.

public bool IsRepeatingSection { get; } #

Gets a value indicating whether the paragraph contains a repeating section control.

public object? Parent { get; internal set; } #

Gets the parent object that owns this paragraph (for example a table cell, header, footer or section).

public bool IsLastRun { get; } #

Gets a value indicating whether this run is the last run within its parent container.

public bool IsFirstRun { get; } #

Gets a value indicating whether this run is the first run within its parent container.

public bool IsListItem { get; } #

Gets a value indicating whether this paragraph is part of a numbered or bulleted list.

public int? ListItemLevel { get; set; } #

Gets or sets the indentation level for the paragraph when it belongs to a list.

public WordListStyle? ListStyle { get; } #

Gets the list style when this paragraph is part of a list.

public WordParagraphStyles? Style { get; set; } #

Gets or sets the paragraph style. Updating this to a heading style will flag the document to update the table of contents on open.

public WordImage? Image { get; } #

Gets the first independent image associated with this run, if any. Group-owned images remain part of their group.

public WordEmbeddedObject? EmbeddedObject { get; } #

Gets the embedded object associated with this run, if any.

public WordChart? Chart { get; } #

Gets the chart contained in this paragraph, if present.

public WordSmartArt? SmartArt { get; } #

Gets the SmartArt diagram contained in this paragraph, if present.

public bool IsImage { get; } #

Gets a value indicating whether an image is found in the paragraph.

public bool IsEmbeddedObject { get; } #

Gets a value indicating whether the paragraph has an embedded object.

public bool IsChart { get; } #

Gets a value indicating whether a chart is associated with the paragraph.

public bool IsSmartArt { get; } #

Gets a value indicating whether SmartArt is present in the paragraph.

public WordTextBox? TextBox { get; } #

Gets the WordTextBox contained within the paragraph, if any.

public WordShape? Shape { get; } #

Returns a WordShape instance when the paragraph contains shapes.

public WordLine? Line { get; } #

Gets the line shape contained in this paragraph, if present.

public bool IsTextBox { get; } #

Gets a value indicating whether the paragraph contains a text box.

public bool IsShape { get; } #

Gets a value indicating whether the paragraph contains a shape.

public bool IsLine { get; } #

Gets a value indicating whether the paragraph contains a VML line shape.

public bool? PageBreakBeforeOverride { get; set; } #

Gets or sets directly authored page-break-before formatting. Null restores style inheritance; false overrides an enabled style.

public bool? KeepWithNextOverride { get; set; } #

Gets or sets directly authored keep-with-next formatting. Null restores style inheritance; false overrides an enabled style.

public bool? KeepLinesTogetherOverride { get; set; } #

Gets or sets directly authored keep-lines-together formatting. Null restores style inheritance; false overrides an enabled style.

public bool? AvoidWidowAndOrphanOverride { get; set; } #

Gets or sets directly authored widow/orphan control. Null restores style inheritance; false disables the control.

public bool? ContextualSpacing { get; set; } #

Gets or sets suppression of spacing between paragraphs of the same style. Null restores style inheritance.

public bool? SuppressLineNumbers { get; set; } #

Gets or sets paragraph line-number suppression. Null restores style inheritance. This preserves the Word setting and does not enable line-number rendering in PDF.

public bool? SuppressAutoHyphens { get; set; } #

Gets or sets paragraph automatic-hyphenation suppression. Null restores style inheritance. Automatic Word hyphenation is not supplied by this property.

public bool? MirrorIndents { get; set; } #

Gets or sets use of left/right indents as inside/outside indents. Null restores style inheritance. Fixed-layout exporters have their own mirrored-layout support limits.

public int? OutlineLevel { get; set; } #

Gets or sets the directly authored outline level: 0-8 for heading levels 1-9, 9 for body text, or null to inherit. Word uses the built-in heading level for Heading1-Heading9 styles regardless of this authored value.

public bool? Hidden { get; set; } #

Gets or sets directly authored hidden formatting on this run. True hides the run, false overrides an inherited hidden setting, and null restores style inheritance. The getter reports direct formatting, not the effective style.

public OfficeLength? KerningMinimumFontSize { get; set; } #

Gets or sets the minimum font size, in points, at which this run uses kerning. Null inherits the threshold; zero disables kerning. Values from zero to 1638 are rounded to Word's half-point precision and are preserved in DOCX and native DOC.

public WordParagraphBorders Borders { get; } #

Provides access to the borders applied to this paragraph.

public string? StyleId { get; } #

Gets the identifier of the paragraph style, if any.

public WordParagraphAlignment? ParagraphAlignment { get; set; } #

Alignment aka Paragraph Alignment. This element specifies the paragraph alignment which shall be applied to text in this paragraph. If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e.that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then no alignment is applied to the paragraph. Setting this property to null removes direct alignment and restores style inheritance.

public WordVerticalCharacterAlignment? VerticalCharacterAlignmentOnLine { get; set; } #

Text Alignment aka Vertical Character Alignment on Line. This element specifies the vertical alignment of all text on each line displayed within a paragraph. If the line height (before any added spacing) is larger than one or more characters on the line, all characters are aligned to each other as specified by this element. If this element is omitted on a given paragraph, its value is determined by the setting previously set at any level of the style hierarchy (i.e.that previous setting remains unchanged). If this setting is never specified in the style hierarchy, then the vertical alignment of all characters on the line shall be automatically determined by the consumer. Setting this property to null removes direct alignment and restores style inheritance.

public OfficeLength? IndentationBefore { get; set; } #

Gets or sets the indentation before the paragraph as a physical length.

public OfficeLength? IndentationAfter { get; set; } #

Gets or sets the indentation after the paragraph as a physical length.

public bool PageBreakBefore { get; set; } #

Gets or sets a directly authored page-break-before value; this does not resolve inherited paragraph styles.

public bool KeepWithNext { get; set; } #

Gets or sets directly authored keep-with-next formatting without resolving paragraph styles.

public bool KeepLinesTogether { get; set; } #

Gets or sets directly authored keep-lines-together formatting without resolving paragraph styles.

public bool AvoidWidowAndOrphan { get; set; } #

Gets or sets directly authored widow and orphan control without resolving paragraph styles.

public OfficeLength? IndentationFirstLine { get; set; } #

Gets or sets the first line indentation as a physical length.

public OfficeLength? IndentationHanging { get; set; } #

Gets or sets the hanging indentation as a physical length.

public WordTextDirection? TextDirection { get; set; } #

Gets or sets the text flow direction for the paragraph.

public bool BiDi { get; set; } #

Gets or sets directly authored right-to-left layout without resolving paragraph styles.

public WordLineSpacing? LineSpacing { get; set; } #

Gets or sets directly authored line spacing as a multiplier, exact height, or minimum height. Null removes both line attributes, retaining before/after and other spacing attributes.

public OfficeLength? LineSpacingBefore { get; set; } #

Gets or sets the spacing before the paragraph as a physical length.

public OfficeLength? LineSpacingAfter { get; set; } #

Gets or sets the spacing after the paragraph as a physical length.

public WordVerticalTextPosition? VerticalTextAlignment { get; set; } #

Gets or sets the vertical text alignment - the alignment of the text in the paragraph with respect to the line height.

public WordBookmark? Bookmark { get; } #

Gets the bookmark associated with this paragraph, if present.

public WordEquation? Equation { get; } #

Gets the mathematical equation contained in this paragraph, if any.

public WordField? Field { get; } #

Gets the field contained in this paragraph, if any.

public WordFootNote? FootNote { get; } #

Gets the footnote associated with this paragraph, if any.

public WordEndNote? EndNote { get; } #

Gets the endnote associated with this paragraph, if any.

public bool IsField { get; } #

Gets a value indicating whether the paragraph hosts a field code.

public bool IsBookmark { get; } #

Gets a value indicating whether the paragraph includes a bookmark start tag.

public bool IsEquation { get; } #

Gets a value indicating whether the paragraph contains an equation.

public bool IsEndNote { get; } #

Gets a value indicating whether an endnote reference is present in the paragraph.

public bool IsFootNote { get; } #

Gets a value indicating whether a footnote reference is present in the paragraph.

public bool IsEmpty { get; } #

Gets a value indicating whether the paragraph contains no run element.

public bool IsPageBreak { get; } #

Gets a value indicating whether the paragraph contains a page break.

public bool IsColumnBreak { get; } #

Gets a value indicating whether the paragraph contains a column break.

public bool IsBreak { get; } #

Gets a value indicating whether the paragraph contains a break element.

public bool Bold { get; set; } #

Gets or sets a value indicating whether the run is bold. Setting false explicitly overrides inherited bold.

public bool Italic { get; set; } #

Gets or sets a value indicating whether the run is italic. Setting false explicitly overrides inherited italic.

public WordUnderlineStyle? Underline { get; set; } #

Gets or sets the underline style for the run.

public bool DoNotCheckSpellingOrGrammar { get; set; } #

Gets or sets a value indicating whether spelling and grammar checks are disabled.

public OfficeLength? Spacing { get; set; } #

Gets or sets the signed physical character spacing. Null removes the local value.

public bool Strikethrough { get; set; } #

Gets or sets a value indicating whether the run is struck through.

public bool DoubleStrikethrough { get; set; } #

Gets or sets a value indicating whether the run has a double strikethrough.

public bool Outline { get; set; } #

Gets or sets a value indicating whether the run text is outlined.

public bool Shadow { get; set; } #

Gets or sets a value indicating whether the run has a shadow effect.

public bool Emboss { get; set; } #

Gets or sets a value indicating whether the run is embossed.

public OfficeLength? FontSize { get; set; } #

Gets or sets the font size in points with Word's native half-point precision. Values finer than half a point are rounded away from zero to the nearest representable size.

public OfficeColor? Color { get; set; } #

Gets or sets the text color using OfficeColor.

public WordThemeColor? ThemeColor { get; set; } #

Gets or sets the theme color applied to the run.

public WordHighlightColor? Highlight { get; set; } #

Gets or sets the highlight color applied to the run.

public WordCapsStyle CapsStyle { get; set; } #

Gets or sets the capitalization style for the run.

public string? FontFamily { get; set; } #

FontFamily gets and sets the FontFamily of a WordParagraph. To make sure that FontFamily works correctly on special characters we change the RunFonts.Ascii and RunFonts.HighAnsi, EastAsia and ComplexScript properties If you want to set different FontFamily for HighAnsi, EastAsia and ComplexScript please use FontFamilyHighAnsi, FontFamilyEastAsia or FontFamilyComplexScript in proper order (to overwrite given FontFamily)

public string? FontFamilyHighAnsi { get; set; } #

Gets or sets the HighAnsi font family.

public string? FontFamilyEastAsia { get; set; } #

Gets or sets the East Asia font family.

public string? FontFamilyComplexScript { get; set; } #

Gets or sets the complex script font family.

public string? Language { get; set; } #

Gets or sets the language applied to the run.

public WordCharacterStyles? CharacterStyle { get; set; } #

Gets or sets the character style applied to the run.

public string? CharacterStyleId { get; set; } #

Gets or sets the style identifier applied to the run.

public OfficeColor? BackgroundColor { get; set; } #

Gets or sets the background (run shading fill) color applied to the current text run.

public OfficeColor? ShadingFillColor { get; set; } #

Get or set the paragraph shading fill color. Setting null removes the shading.

public WordShadingPattern? ShadingPattern { get; set; } #

Get or set the paragraph shading pattern.

public WordShapeGroup? ShapeGroup { get; } #

Gets the native DrawingML shape group hosted by this paragraph, when present.

public bool IsShapeGroup { get; } #

Gets whether this paragraph hosts a native DrawingML shape group.

public string Text { get; set; } #

Gets or sets the text for this run. Text-wrapping breaks (null or BreakValues.TextWrapping) are surfaced as "\n" in the returned string so callers receive the same representation on every platform. The setter accepts any mix of "\r\n", "\r", or "\n" and normalizes them to "\n" before updating the OpenXML elements. Non text-wrapping breaks—such as page or column breaks—are represented using the Unicode line separator character ('\u2028') so that text operations (for example find/replace) can preserve their positions. When the text is modified those breaks are re-inserted at their original locations. Imported text nodes honor xml:space: insignificant XML whitespace at either edge is omitted unless the node declares preserve. Reading text preserves source XML.

Extension Methods

public static string ToXml(WordParagraph paragraph) #

Returns the raw Open XML string representing the paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph required
Paragraph to convert.

Returns

string Outer XML of the underlying Open XML element.