API Reference
WordParagraph
Represents a paragraph within a Word document.
Inheritance
- WordElement
- WordParagraph
Constructors
public WordParagraph(WordDocument document, Paragraph paragraph, Run run) #Initializes a new paragraph.
Parameters
- document OfficeIMO.Word.WordDocument = null
- Parent document.
- newParagraph System.Boolean = true
- Create a new paragraph element.
- newRun System.Boolean = true
- Create a new run inside the paragraph.
public WordParagraph(WordDocument document, Paragraph paragraph) #Wraps an existing paragraph from the document.
Parameters
- document OfficeIMO.Word.WordDocument
- Parent document.
- paragraph DocumentFormat.OpenXml.Wordprocessing.Paragraph
- Paragraph to wrap.
WordParagraph(OfficeIMO.Word.WordDocument document, DocumentFormat.OpenXml.Wordprocessing.Paragraph paragraph, DocumentFormat.OpenXml.Wordprocessing.Run run) #Wraps an existing paragraph and run from the document.
Parameters
- document OfficeIMO.Word.WordDocument
- Parent document.
- paragraph DocumentFormat.OpenXml.Wordprocessing.Paragraph
- Paragraph to wrap.
- run DocumentFormat.OpenXml.Wordprocessing.Run
- Run within the paragraph.
Methods
public WordParagraph AddBookmark(String bookmarkName) #WordParagraphAdd bookmark to a word document proceeding from the paragraph this was called on.
Parameters
- bookmarkName System.String
- The name of the bookmark.
Returns
The paragraph that this was called on.
public WordParagraph AddBreak(Nullable<BreakValues> breakType = null) #WordParagraphAdd Break to the paragraph. By default it adds soft break (SHIFT+ENTER)
Parameters
- breakType System.Nullable{DocumentFormat.OpenXml.Wordprocessing.BreakValues} = null
- Optional argument to add a specific type of break.
Returns
The new WordParagraph that this method creates.
public WordChart AddChart(String title = "", Boolean roundedCorners = false, Int32 width = 600, Int32 height = 600) #WordChartAdds 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 System.String = ""
- The title.
- roundedCorners System.Boolean = false
- if set to true [rounded corners].
- width System.Int32 = 600
- The width.
- height System.Int32 = 600
- The height.
Returns
WordChart
public WordCheckBox AddCheckBox(Boolean isChecked = false, String alias = null, String tag = null) #WordCheckBoxAdds a checkbox content control to the paragraph.
Parameters
- isChecked System.Boolean = false
- Initial checked state.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
Returns
The created WordCheckBox instance.
public WordParagraph AddCitation(String sourceTag) #WordParagraphAdds a citation field referencing the specified source tag.
Parameters
- sourceTag System.String
- Tag of the bibliographic source.
Returns
The paragraph that this was called on.
public WordComboBox AddComboBox(IEnumerable<String> items, String alias = null, String tag = null, String defaultValue = null) #WordComboBoxAdds a combo box content control to the paragraph.
Parameters
- items System.Collections.Generic.IEnumerable{System.String}
- Items to include in the combo box.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
- defaultValue System.String = null
- Optional default value to display; must match one of the provided items.
Returns
The created WordComboBox instance.
public WordChart AddComboChart(String title = "", Boolean roundedCorners = false, Int32 width = 600, Int32 height = 600) #WordChartCreates a chart ready for combining bar and line series. Use String>) to supply category labels and then call Color) or Color) to add data. AddChartAxisX must be called before adding any series so that both chart types share the same axes.
Parameters
- title System.String = ""
- roundedCorners System.Boolean = false
- width System.Int32 = 600
- height System.Int32 = 600
public Void AddComment(String author, String initials, String comment) #VoidAdd a comment to paragraph
Parameters
- author System.String
- The name of the commenting author
- initials System.String
- The initials of the commenting author
- comment System.String
- The comment text
public WordParagraph AddCrossReference(String referenceId, WordCrossReferenceType type) #WordParagraphAdds a cross reference field to the paragraph.
Parameters
- referenceId System.String
- Bookmark or heading identifier.
- type OfficeIMO.Word.WordCrossReferenceType
- Type of reference.
Returns
The paragraph that this was called on.
public WordDatePicker AddDatePicker(Nullable<DateTime> date = null, String alias = null, String tag = null) #WordDatePickerAdds a date picker content control to the paragraph.
Parameters
- date System.Nullable{System.DateTime} = null
- Initial date value.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
Returns
The created WordDatePicker instance.
public WordParagraph AddDeletedText(String text, String author, Nullable<DateTime> date = null) #WordParagraphInserts revision text marked as deleted.
Parameters
- text System.String
- Text to delete.
- author System.String
- Revision author.
- date System.Nullable{System.DateTime} = null
- Revision date. Uses current date when null.
Returns
The current WordParagraph instance.
public WordDropDownList AddDropDownList(IEnumerable<String> items, String alias = null, String tag = null) #WordDropDownListAdds a dropdown list content control to the paragraph.
Parameters
- items System.Collections.Generic.IEnumerable{System.String}
- Items to include in the list.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
Returns
The created WordDropDownList instance.
public WordParagraph AddEmbeddedObject(String filePath, String imageFilePath, Nullable<Double> width = null, Nullable<Double> height = null) #WordParagraphEmbeds an object with a preview image.
Parameters
- filePath System.String
- Path to the object file.
- imageFilePath System.String
- Preview image path.
- width System.Nullable{System.Double} = null
- Optional width in points.
- height System.Nullable{System.Double} = null
- Optional height in points.
Returns
The paragraph containing the embedded object.
public WordParagraph AddEmbeddedObject(String filePath, WordEmbeddedObjectOptions options) #WordParagraphEmbeds an object with custom options.
Parameters
- filePath System.String
- Path to the object file.
- options OfficeIMO.Word.WordEmbeddedObjectOptions
- Embedding options.
Returns
The paragraph containing the embedded object.
public WordParagraph AddEndNote(String text) #WordParagraphAdd an end note to the document for this paragraph.
Parameters
- text System.String
- The text of the end note.
Returns
The end note.
public WordParagraph AddEquation(String omml) #WordParagraphAdds a mathematical equation represented as OMML XML.
Parameters
- omml System.String
- Office Math Markup Language (OMML) fragment.
Returns
The paragraph that this was called on.
public WordParagraph AddField(WordFieldType wordFieldType, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false, List<String> parameters = null) #WordParagraphAdd fields to a word document proceeding from the paragraph this is called on.
Parameters
- wordFieldType OfficeIMO.Word.WordFieldType
- The type of field to add.
- wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- The format of the field to add.
- customFormat System.String = null
- Custom format string for date or time fields.
- advanced System.Boolean = false
- Use advanced field representation.
- parameters System.Collections.Generic.List{System.String} = null
- 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
The paragraph that this was called on.
public WordParagraph AddField(WordFieldCode fieldCode, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false) #WordParagraphAdd a field represented by a WordFieldCode.
Parameters
- fieldCode OfficeIMO.Word.WordFieldCode
- Field code instance describing instructions and switches.
- wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional field format.
- customFormat System.String = null
- Custom format string for date or time fields.
- advanced System.Boolean = false
- Use advanced field representation.
Returns
The paragraph that this was called on.
public WordParagraph AddField(WordFieldBuilder builder, Boolean advanced = false) #WordParagraphAdds a field constructed using WordFieldBuilder.
Parameters
- builder OfficeIMO.Word.WordFieldBuilder
- Field builder instance.
- advanced System.Boolean = false
- Use advanced field representation.
Returns
The paragraph that this was called on.
public WordParagraph AddFootNote(String text) #WordParagraphAdd a foot note for the current paragraph.
Parameters
- text System.String
- The text of the note.
Returns
The footnote.
public WordParagraph AddFormattedText(String text, Boolean bold = false, Boolean italic = false, Nullable<UnderlineValues> underline = null) #WordParagraphAdds formatted text to the paragraph and applies basic run properties.
Parameters
- text System.String
- Text to insert.
- bold System.Boolean = false
- Whether the text should be bold.
- italic System.Boolean = false
- Whether the text should be italic.
- underline System.Nullable{DocumentFormat.OpenXml.Wordprocessing.UnderlineValues} = null
- Optional underline style.
Returns
The run containing the formatted text.
public WordParagraph AddHorizontalLine(Nullable<BorderValues> lineType = null, Nullable<Color> color = null, UInt32 size = 12, UInt32 space = 1) #WordParagraphAdd horizontal line (sometimes known as horizontal rule) to document proceeding from the paragraph that this is called on.
Parameters
- lineType System.Nullable{DocumentFormat.OpenXml.Wordprocessing.BorderValues} = null
- The type of the line.
- color System.Nullable{SixLabors.ImageSharp.Color} = null
- The color of the line
- size System.UInt32 = 12
- The size of the line.
- space System.UInt32 = 1
- The space the line takes up.
Returns
The new Paragraph after the line.
public WordParagraph AddHyperLink(String text, Uri uri, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdd hyperlink with URL to a word document proceding from the paragraph that this was called on.
Parameters
- text System.String
- The text to insert as the URL.
- uri System.Uri
- The uri that this points to.
- addStyle System.Boolean = false
- The optional style of the link.
- tooltip System.String = ""
- The optional tooltip to display over the link.
- history System.Boolean = true
Returns
The paragraph that this was called on.
public WordParagraph AddHyperLink(String text, String anchor, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdd hyperlink with an anchor to a word document proceding from the paragraph that this was called on.
Parameters
- text System.String
- The text to insert as the URL.
- anchor System.String
- The anchor to point at.
- addStyle System.Boolean = false
- The optional style of this link.
- tooltip System.String = ""
- The optional tooltip over this link.
- history System.Boolean = true
Returns
The paragraph that this was called on.
public WordParagraph AddImage(Uri imageUri, Double width, Double height, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordParagraphAdd image from file with ability to provide width and height of the image The image will be resized given new dimensions
Parameters
- filePathImage System.String
- Path to file to import to Word Document
- width System.Nullable{System.Double} = null
- Optional width of the image. If not given the actual image width will be used.
- height System.Nullable{System.Double} = null
- Optional height of the image. If not given the actual image height will be used.
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- Optional text wrapping rule. If not given the image will be inserted inline to the text.
- description System.String = ""
- The description for this image.
Returns
The WordParagraph that AddImage was called on.
public WordParagraph AddImage(Stream imageStream, String fileName, Nullable<Double> width, Nullable<Double> height, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordParagraphAdd image from Stream with ability to provide width and height of the image The image will be resized given new dimensions
Parameters
- imageStream System.IO.Stream
- The stream to load the image from.
- fileName System.String
- The name of the file.
- width System.Nullable{System.Double}
- Optional width of the image. If not given the actual image width will be used.
- height System.Nullable{System.Double}
- Optional height of the image. If not give the actual image height will be used.
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- Optional text wrapping rule. If not given the image will be inserted inline to the text.
- description System.String = ""
- The description for this image.
Returns
The WordParagraph that AddImage was called on.
AddImage(System.Uri imageUri, System.Double width, System.Double height, OfficeIMO.Word.WrapTextImage wrapImageText, System.String description) #Add an image that is stored outside the package.
Parameters
- imageUri System.Uri
- width System.Double
- height System.Double
- wrapImageText OfficeIMO.Word.WrapTextImage
- description System.String
public WordParagraph AddImageFromBase64(String base64String, String fileName, Nullable<Double> width = null, Nullable<Double> height = null, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordParagraphAdd image from a Base64 encoded string.
Parameters
- base64String System.String
- fileName System.String
- width System.Nullable{System.Double} = null
- height System.Nullable{System.Double} = null
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
public WordParagraph AddImageFromResource(Assembly assembly, String resourceName, Nullable<Double> width = null, Nullable<Double> height = null, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordParagraphAdd image from an embedded resource.
Parameters
- assembly System.Reflection.Assembly
- Assembly that contains the resource.
- resourceName System.String
- Full name of the embedded resource.
- width System.Nullable{System.Double} = null
- Optional width of the image.
- height System.Nullable{System.Double} = null
- Optional height of the image.
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- Optional text wrapping rule.
- description System.String = ""
- The description for this image.
Returns
The WordParagraph that AddImage was called on.
public WordParagraph AddImageVml(String filePathImage, Nullable<Double> width = null, Nullable<Double> height = null) #WordParagraphAdds a legacy VML image to the paragraph.
Parameters
- filePathImage System.String
- width System.Nullable{System.Double} = null
- height System.Nullable{System.Double} = null
public WordParagraph AddInsertedText(String text, String author, Nullable<DateTime> date = null) #WordParagraphInserts revision text marked as added.
Parameters
- text System.String
- Text to insert.
- author System.String
- Revision author.
- date System.Nullable{System.DateTime} = null
- Revision date. Uses current date when null.
Returns
The current WordParagraph instance.
public WordLine AddLine(Double startXPt, Double startYPt, Double endXPt, Double endYPt, Color color, Double strokeWeightPt = 1) #WordLineAdd a line shape to the paragraph.
Parameters
- startXPt System.Double
- Start X position in points.
- startYPt System.Double
- Start Y position in points.
- endXPt System.Double
- End X position in points.
- endYPt System.Double
- End Y position in points.
- color System.String = "#000000"
- Stroke color in hex format.
- strokeWeightPt System.Double = 1
- Stroke weight in points.
AddLine(System.Double startXPt, System.Double startYPt, System.Double endXPt, System.Double endYPt, SixLabors.ImageSharp.Color color, System.Double strokeWeightPt) #Add a line shape to the paragraph using Color.
Parameters
- startXPt System.Double
- startYPt System.Double
- endXPt System.Double
- endYPt System.Double
- color SixLabors.ImageSharp.Color
- strokeWeightPt System.Double
public WordList AddList(WordListStyle style) #WordListAdd a list after this paragraph.
Parameters
- style OfficeIMO.Word.WordListStyle
- The style of this list.
Returns
The new list.
public WordParagraph AddPageNumber(Boolean includeTotalPages = false, Nullable<WordFieldFormat> format = null, String separator = " of ") #WordParagraphAdds a page number field to the paragraph.
Parameters
- includeTotalPages System.Boolean = false
- If true adds a NUMPAGES field preceded by text " of ".
- format System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional field format to apply.
- separator System.String = " of "
- Text inserted between the current page and total pages fields.
Returns
The paragraph that this was called on.
public WordParagraph AddParagraph(WordParagraph wordParagraph = null) #WordParagraphAdd 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 WordParagraph to insert after the given WordParagraph instead of at the end of the document.
Returns
The inserted WordParagraph.
public WordParagraph AddParagraph(String text) #WordParagraphAdd a paragraph with the given text to the end of the document.
Parameters
- text System.String
- The text to fill the paragraph with.
Returns
The appended WordParagraph.
public WordParagraph AddParagraphAfterSelf() #WordParagraphInsert a new paragraph after the WordParagraph AddParagraphAfterSelf is called on in the document.
Returns
The inserted WordParagraph
public WordParagraph AddParagraphAfterSelf(WordSection section, WordParagraph paragraph = null) #WordParagraphAdd paragraph after self but by allowing to specify section
Parameters
- section OfficeIMO.Word.WordSection
- The section to add the paragraph to. When paragraph is given this has no effect.
- paragraph OfficeIMO.Word.WordParagraph = null
- The optional paragraph to add the paragraph to.
Returns
The new WordParagraph
public WordParagraph AddParagraphBeforeSelf() #WordParagraphAdd a paragraph before the paragraph that AddParagraphBeforeSelf was called on.
Returns
The inserted paragraph
public WordPictureControl AddPictureControl(String filePath, Nullable<Double> width = null, Nullable<Double> height = null, String alias = null, String tag = null) #WordPictureControlAdds a picture content control containing an image to the paragraph.
Parameters
- filePath System.String
- Image file path.
- width System.Nullable{System.Double} = null
- Optional width of the image.
- height System.Nullable{System.Double} = null
- Optional height of the image.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
Returns
The created WordPictureControl instance.
public WordRepeatingSection AddRepeatingSection(String sectionTitle = null, String alias = null, String tag = null) #WordRepeatingSectionAdds a repeating section content control to the paragraph.
Parameters
- sectionTitle System.String = null
- Optional title of the repeating section.
- alias System.String = null
- Optional alias for the control.
- tag System.String = null
- Optional tag for the control.
Returns
The created WordRepeatingSection instance.
public WordShape AddShape(Double widthPt, Double heightPt, Color fillColor) #WordShapeAdd a rectangle shape to the paragraph.
Parameters
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
- fillColor System.String = "#FFFFFF"
- Fill color in hex format.
AddShape(System.Double widthPt, System.Double heightPt, SixLabors.ImageSharp.Color fillColor) #Add a rectangle shape to the paragraph using Color.
Parameters
- widthPt System.Double
- heightPt System.Double
- fillColor SixLabors.ImageSharp.Color
public WordShape AddShape(ShapeType shapeType, Double widthPt, Double heightPt, Color fillColor, Color strokeColor, Double strokeWeightPt = 1, Double arcSize = 0.25) #WordShapeAdds a basic shape to the paragraph.
Parameters
- shapeType OfficeIMO.Word.ShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points or line end X.
- heightPt System.Double
- Height in points or line end Y.
- fillColor System.String = "#FFFFFF"
- Fill color in hex format.
- strokeColor System.String = "#000000"
- Stroke color in hex format.
- strokeWeightPt System.Double = 1
- Stroke weight in points.
- arcSize System.Double = 0.25
- Corner roundness fraction for rounded rectangles.
AddShape(OfficeIMO.Word.ShapeType shapeType, System.Double widthPt, System.Double heightPt, SixLabors.ImageSharp.Color fillColor, SixLabors.ImageSharp.Color strokeColor, System.Double strokeWeightPt, System.Double arcSize) #Adds a basic shape to the paragraph using Color values.
Parameters
- shapeType OfficeIMO.Word.ShapeType
- widthPt System.Double
- heightPt System.Double
- fillColor SixLabors.ImageSharp.Color
- strokeColor SixLabors.ImageSharp.Color
- strokeWeightPt System.Double
- arcSize System.Double
public WordShape AddShapeDrawing(ShapeType shapeType, Double widthPt, Double heightPt) #WordShapeAdds a DrawingML shape to the paragraph.
Parameters
- shapeType OfficeIMO.Word.ShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
public WordShape AddShapeDrawing(ShapeType shapeType, Double widthPt, Double heightPt, Double leftPt, Double topPt) #WordShapeAdds a DrawingML shape anchored at an absolute position on the page.
Parameters
- shapeType OfficeIMO.Word.ShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
- leftPt System.Double
- Left offset from page in points.
- topPt System.Double
- Top offset from page in points.
public WordSmartArt AddSmartArt(SmartArtType type) #WordSmartArtInserts a SmartArt diagram at the current position.
Parameters
- type OfficeIMO.Word.SmartArtType
- Layout of SmartArt to create.
Returns
The created WordSmartArt.
public WordStructuredDocumentTag AddStructuredDocumentTag(String text = "", String alias = null, String tag = null) #WordStructuredDocumentTagAdds a simple content control (structured document tag) to the paragraph.
Parameters
- text System.String = ""
- Initial text of the control.
- alias System.String = null
- Optional alias for the content control.
- tag System.String = null
- Optional tag for the content control.
Returns
The created WordStructuredDocumentTag instance.
public WordParagraph AddTab() #WordParagraphAdds a Tab to a paragraph
Returns
The paragraph this is called on.
public WordTable AddTableAfter(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #WordTableAdd a table after this paragraph and return the table.
Parameters
- rows System.Int32
- The number of rows in the table.
- columns System.Int32
- The number of columns in the table.
- tableStyle OfficeIMO.Word.WordTableStyle = TableGrid
- The optional style to be applied to the new table, defaults to TableGrid.
Returns
The new added table.
public WordTable AddTableBefore(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #WordTableAdd a table before this paragraph and return the table.
Parameters
- rows System.Int32
- The number of rows in this table
- columns System.Int32
- The number of columns in this table
- tableStyle OfficeIMO.Word.WordTableStyle = TableGrid
- The style of the table being added.
Returns
The new added table.
public WordTabStop AddTabStop(Int32 position, Nullable<TabStopValues> alignment = null, Nullable<TabStopLeaderCharValues> leader = null) #WordTabStopProvides ability for configuration of Tabs in a paragraph by adding one or more TabStops
Parameters
- position System.Int32
- The position of the tabs in the paragraph.
- alignment System.Nullable{DocumentFormat.OpenXml.Wordprocessing.TabStopValues} = null
- The optional alignment for the tabs.
- leader System.Nullable{DocumentFormat.OpenXml.Wordprocessing.TabStopLeaderCharValues} = null
- The optional rune to use before the tabs.
Returns
The added tabs.
public WordParagraph AddText(String text) #WordParagraphAdd a text to existing paragraph
Parameters
- text System.String
- The text to be added to the paragraph.
Returns
The paragraph containing the new text.
public WordTextBox AddTextBox(String text, WrapTextImage wrapTextImage) #WordTextBoxAdd a text box to the document.
Parameters
- text System.String
- The text inside the text box.
- wrapTextImage OfficeIMO.Word.WrapTextImage
- The text image wrapping settings.
public WordTextBox AddTextBoxVml(String text) #WordTextBoxAdds a legacy VML text box to the paragraph.
Parameters
- text System.String
public virtual Boolean Equals(WordParagraph other) #BooleanDetermines whether the specified WordParagraph is equal to the current instance.
Parameters
- other OfficeIMO.Word.WordParagraph
- The paragraph to compare with the current instance.
Returns
true if the paragraphs are equal; otherwise, false.
public override Boolean Equals(Object obj) #BooleanDetermines whether the specified object is equal to the current instance.
Parameters
- obj System.Object
- The object to compare with the current instance.
Returns
true if the objects are equal; otherwise, false.
public override Int32 GetHashCode() #Int32Serves as the default hash function.
Returns
A hash code for the current object.
public Nullable<WordListStyle> GetListStyle() #Nullable<WordListStyle>Gets the list style when this paragraph is part of a list.
public IEnumerable<WordParagraph> GetRuns() #IEnumerable<WordParagraph>Enumerates all runs within the paragraph, including runs nested in hyperlinks.
public WordImage InsertImage(Uri imageUri, Double width, Double height, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordImageInserts an image and returns the created WordImage for immediate configuration. This is a convenience alternative to String) when you want to set properties on the inserted image without accessing Image.
Parameters
- filePathImage System.String
- width System.Nullable{System.Double} = null
- height System.Nullable{System.Double} = null
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
public WordImage InsertImage(Stream imageStream, String fileName, Nullable<Double> width = null, Nullable<Double> height = null, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordImageInserts an image from a stream and returns the created WordImage.
Parameters
- imageStream System.IO.Stream
- fileName System.String
- width System.Nullable{System.Double} = null
- height System.Nullable{System.Double} = null
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
InsertImage(System.Uri imageUri, System.Double width, System.Double height, OfficeIMO.Word.WrapTextImage wrapImageText, System.String description) #Inserts an external image (by URI) and returns the created WordImage.
Parameters
- imageUri System.Uri
- width System.Double
- height System.Double
- wrapImageText OfficeIMO.Word.WrapTextImage
- description System.String
public WordImage InsertImageFromBase64(String base64String, String fileName, Nullable<Double> width = null, Nullable<Double> height = null, WrapTextImage wrapImageText = InLineWithText, String description = "") #WordImageInserts an image from a Base64 payload and returns the created WordImage.
Parameters
- base64String System.String
- fileName System.String
- width System.Nullable{System.Double} = null
- height System.Nullable{System.Double} = null
- wrapImageText OfficeIMO.Word.WrapTextImage = InLineWithText
- description System.String = ""
Location() #Checks where the paragraph is located. If it is located in the header, footer or main document. This is required for the image processing to work properly for header and footers as the location of the image matters to be able to display it properly.
op_Equality(OfficeIMO.Word.WordParagraph left, OfficeIMO.Word.WordParagraph right) #Determines whether two WordParagraph instances are equal.
Parameters
- left OfficeIMO.Word.WordParagraph
- The left-hand instance.
- right OfficeIMO.Word.WordParagraph
- The right-hand instance.
Returns
true if the instances are equal; otherwise, false.
op_Inequality(OfficeIMO.Word.WordParagraph left, OfficeIMO.Word.WordParagraph right) #Determines whether two WordParagraph instances are not equal.
Parameters
- left OfficeIMO.Word.WordParagraph
- The left-hand instance.
- right OfficeIMO.Word.WordParagraph
- The right-hand instance.
Returns
true if the instances are not equal; otherwise, false.
public Void Remove() #VoidRemove the paragraph from WordDocument
Exceptions
InvalidOperationException
public Void RemoveHyperLink(Boolean includingParagraph = false) #VoidRemoves hyperlink from this paragraph and detaches its relationship.
Parameters
- includingParagraph System.Boolean = false
- If true removes the paragraph when it becomes empty.
public WordParagraph SetAlignment(JustificationValues alignment) #WordParagraphSets the paragraph alignment.
Parameters
- alignment DocumentFormat.OpenXml.Wordprocessing.JustificationValues
- Alignment value.
Returns
The current paragraph instance.
public WordParagraph SetBold(Boolean isBold = true) #WordParagraphSets the Bold property.
Parameters
- isBold System.Boolean = true
- Whether the text should be bold.
Returns
The current paragraph instance.
public WordParagraph SetCapsStyle(CapsStyle capsStyle) #WordParagraphSets the capitalization style for the text.
Parameters
- capsStyle OfficeIMO.Word.CapsStyle
- Capitalization style.
Returns
The current paragraph instance.
public WordParagraph SetCharacterStyle(WordCharacterStyles style) #WordParagraphSets the character style for the run.
Parameters
- style OfficeIMO.Word.WordCharacterStyles
- Character style to apply.
Returns
The current paragraph instance.
public WordParagraph SetCharacterStyleId(String styleId) #WordParagraphSets the character style by identifier.
Parameters
- styleId System.String
- The style identifier.
Returns
The current paragraph instance.
public Void SetCheckBoxValue(Boolean value) #VoidSets the checked state of the paragraph's checkbox.
Parameters
- value System.Boolean
- New checked state.
public WordParagraph SetColor(Color color) #WordParagraphSets the text color using Color.
Parameters
- color SixLabors.ImageSharp.Color
- The color to apply.
Returns
The current paragraph instance.
public WordParagraph SetColorHex(String color) #WordParagraphSets the text color using a hexadecimal value.
Parameters
- color System.String
- Color in hexadecimal format.
Returns
The current paragraph instance.
public WordParagraph SetDoubleStrike(Boolean isDoubleStrike = true) #WordParagraphEnables or disables double strikethrough on the text.
Parameters
- isDoubleStrike System.Boolean = true
- Whether the text should be double struck.
Returns
The current paragraph instance.
public WordParagraph SetEmboss(Boolean isEmboss = true) #WordParagraphEnables or disables emboss effect on the text.
Parameters
- isEmboss System.Boolean = true
- Whether the text should be embossed.
Returns
The current paragraph instance.
public WordParagraph SetFontFamily(String fontFamily) #WordParagraphSets the font family for the text.
Parameters
- fontFamily System.String
- Name of the font family.
Returns
The current paragraph instance.
public WordParagraph SetFontSize(Int32 fontSize) #WordParagraphSets the font size for the text.
Parameters
- fontSize System.Int32
- Font size in points.
Returns
The current paragraph instance.
public WordParagraph SetHighlight(HighlightColorValues highlight) #WordParagraphSets the highlight color for the text.
Parameters
- highlight DocumentFormat.OpenXml.Wordprocessing.HighlightColorValues
- Highlight color.
Returns
The current paragraph instance.
public WordParagraph SetItalic(Boolean isItalic = true) #WordParagraphSets the Italic property.
Parameters
- isItalic System.Boolean = true
- Whether the text should be italic.
Returns
The current paragraph instance.
public WordParagraph SetOutline(Boolean isOutline = true) #WordParagraphEnables or disables outline effect on the text.
Parameters
- isOutline System.Boolean = true
- Whether the text should be outlined.
Returns
The current paragraph instance.
public WordParagraph SetShadow(Boolean isShadow = true) #WordParagraphEnables or disables shadow effect on the text.
Parameters
- isShadow System.Boolean = true
- Whether the text should have a shadow.
Returns
The current paragraph instance.
public WordParagraph SetSmallCaps(Boolean isSmallCaps = true) #WordParagraphEnables or disables small caps formatting on the text.
Parameters
- isSmallCaps System.Boolean = true
- Whether the text should use small caps.
Returns
The current paragraph instance.
public WordParagraph SetSpacing(Int32 spacing) #WordParagraphSets the character spacing for the text.
Parameters
- spacing System.Int32
- Spacing value in twentieths of a point.
Returns
The current paragraph instance.
public WordParagraph SetStrike(Boolean isStrike = true) #WordParagraphEnables or disables single strikethrough on the text.
Parameters
- isStrike System.Boolean = true
- Whether the text should be struck through.
Returns
The current paragraph instance.
public WordParagraph SetStyle(WordParagraphStyles style) #WordParagraphSets the paragraph style.
Parameters
- style OfficeIMO.Word.WordParagraphStyles
- The style to apply.
Returns
The current paragraph instance.
public WordParagraph SetStyleId(String styleId) #WordParagraphSets the paragraph style by identifier.
Parameters
- styleId System.String
- The style identifier.
Returns
The current paragraph instance.
public WordParagraph SetText(String text) #WordParagraphSets the paragraph text.
Parameters
- text System.String
- The text content.
Returns
The current paragraph instance.
public WordParagraph SetUnderline(UnderlineValues underline) #WordParagraphSets the underline style for the text.
Parameters
- underline DocumentFormat.OpenXml.Wordprocessing.UnderlineValues
- Underline style.
Returns
The current paragraph instance.
public WordParagraph SetVerticalTextAlignment(Nullable<VerticalPositionValues> verticalPositionValue) #WordParagraphSet the vertical text alignment
Parameters
- verticalPositionValue System.Nullable{DocumentFormat.OpenXml.Wordprocessing.VerticalPositionValues}
VerifyRun() #Check if run exists, if not create it and append to paragraph
VerifyRunProperties() #Check if runProperties exists in run, if not create run, create run properties and and append to run
VerifyText() #Returns a Text field. If it doesn't exits creates it.
Inherited Methods
Properties
public Object Parent { get; set; } #Gets the parent object that owns this paragraph (for example a table cell, header, footer or section).
TopParent #This allows to know where the paragraph is located. Useful for hyperlinks or other stuff.
public Boolean IsLastRun { get; } #Gets a value indicating whether this run is the last run within its parent container.
public Boolean IsFirstRun { get; } #Gets a value indicating whether this run is the first run within its parent container.
public WordImage Image { get; } #Gets the first image associated with this run, if any.
public WordEmbeddedObject EmbeddedObject { get; } #Gets the embedded object associated with this run, if any.
public Boolean IsListItem { get; } #Gets a value indicating whether this paragraph is part of a numbered or bulleted list.
public Nullable<Int32> ListItemLevel { get; set; } #Gets or sets the indentation level for the paragraph when it belongs to a list.
public Nullable<WordListStyle> ListStyle { get; } #Gets the list style when this paragraph is part of a list.
public Nullable<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 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.
public WordBreak PageBreak { get; } #Get PageBreaks within Paragraph
public WordTabChar Tab { get; } #Gets the WordTabChar representing a tab character in the current run, or null if none is 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 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 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 WordHyperLink Hyperlink { get; } #Gets the hyperlink contained in this paragraph, if present.
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 Boolean IsHyperLink { get; } #Gets a value indicating whether the paragraph contains a hyperlink.
public Boolean IsField { get; } #Gets a value indicating whether the paragraph hosts a field code.
public Boolean IsBookmark { get; } #Gets a value indicating whether the paragraph includes a bookmark start tag.
public Boolean IsEquation { get; } #Gets a value indicating whether the paragraph contains an equation.
public Boolean IsStructuredDocumentTag { get; } #Gets a value indicating whether the paragraph holds a structured document tag.
public Boolean IsCheckBox { get; } #Gets a value indicating whether the paragraph contains a checkbox control.
public Boolean IsDatePicker { get; } #Gets a value indicating whether the paragraph contains a date picker control.
public Boolean IsDropDownList { get; } #Gets a value indicating whether the paragraph contains a dropdown list control.
public Boolean IsComboBox { get; } #Gets a value indicating whether the paragraph contains a combo box control.
public Boolean IsPictureControl { get; } #Gets a value indicating whether the paragraph contains a picture control.
public Boolean IsRepeatingSection { get; } #Gets a value indicating whether the paragraph contains a repeating section control.
public Boolean IsImage { get; } #Gets a value indicating whether an image is found in the paragraph.
public Boolean IsEmbeddedObject { get; } #Gets a value indicating whether the paragraph has an embedded object.
public Boolean IsTab { get; } #Gets a value indicating whether the run within the paragraph contains a tab character.
public Boolean IsChart { get; } #Gets a value indicating whether a chart is associated with the paragraph.
public Boolean IsSmartArt { get; } #Gets a value indicating whether SmartArt is present in the paragraph.
public Boolean IsEndNote { get; } #Gets a value indicating whether an endnote reference is present in the paragraph.
public Boolean IsFootNote { get; } #Gets a value indicating whether a footnote reference is present in the paragraph.
public List<WordTabStop> TabStops { get; } #Gets all tab stops defined on the paragraph.
public WordTextBox TextBox { get; } #Gets the WordTextBox contained within the paragraph, if any.
public WordLine Line { get; } #Gets the line shape contained in this paragraph, if present.
public Boolean IsTextBox { get; } #Gets a value indicating whether the paragraph contains a text box.
public Boolean IsShape { get; } #Gets a value indicating whether the paragraph contains a shape.
public Boolean IsLine { get; } #Gets a value indicating whether the paragraph contains a VML line shape.
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 Nullable<JustificationValues> 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.
public Nullable<VerticalTextAlignmentValues> 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.
public Nullable<Int32> IndentationBefore { get; set; } #Gets or sets the indentation before the paragraph in twips (1/20 of a point).
public Nullable<Double> IndentationBeforePoints { get; set; } #Gets or sets the indentation before in points.
public Nullable<Int32> IndentationAfter { get; set; } #Gets or sets the indentation after the paragraph in twips (1/20 of a point).
public Nullable<Double> IndentationAfterPoints { get; set; } #Gets or sets the indentation after in points.
public Boolean PageBreakBefore { get; set; } #The property which puts a paragraph on the beginning of a next side without add a page break to the document
Value
bool
public Boolean KeepWithNext { get; set; } #Keeps this paragraph on the same page as the following paragraph.
public Boolean KeepLinesTogether { get; set; } #Keeps all lines in this paragraph together on the same page.
public Boolean AvoidWidowAndOrphan { get; set; } #Enables widow and orphan control for this paragraph.
public Nullable<Int32> IndentationFirstLine { get; set; } #Gets or sets the first line indentation in twips (1/20 of a point).
public Nullable<Double> IndentationFirstLinePoints { get; set; } #Gets or sets the first line indentation in points.
public Nullable<Int32> IndentationHanging { get; set; } #Gets or sets the hanging indentation in twips (1/20 of a point).
public Nullable<Double> IndentationHangingPoints { get; set; } #Gets or sets the hanging indentation in points.
public Nullable<TextDirectionValues> TextDirection { get; set; } #Gets or sets the text flow direction for the paragraph.
public Boolean BiDi { get; set; } #Indicates that paragraph text should be displayed from right to left.
public Nullable<LineSpacingRuleValues> LineSpacingRule { get; set; } #Gets or sets the rule used to calculate line spacing for the paragraph.
public Nullable<Int32> LineSpacing { get; set; } #Gets or sets the line spacing for the paragraph in twips (1/20 of a point).
public Nullable<Double> LineSpacingPoints { get; set; } #Gets or sets the line spacing in points.
public Nullable<Int32> LineSpacingBefore { get; set; } #Gets or sets the spacing before the paragraph in twips (1/20 of a point).
public Nullable<Double> LineSpacingBeforePoints { get; set; } #Gets or sets the line spacing before in points.
public Nullable<Int32> LineSpacingAfter { get; set; } #Gets or sets the spacing after the paragraph in twips (1/20 of a point).
public Nullable<Double> LineSpacingAfterPoints { get; set; } #Gets or sets the line spacing after in points.
public Nullable<VerticalPositionValues> 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 Boolean IsEmpty { get; } #Gets a value indicating whether the paragraph contains no run element.
public Boolean IsPageBreak { get; } #Gets a value indicating whether the paragraph contains a page break.
public Boolean IsBreak { get; } #Gets a value indicating whether the paragraph contains a break element.
public Boolean Bold { get; set; } #Gets or sets a value indicating whether the run is bold.
public Boolean Italic { get; set; } #Gets or sets a value indicating whether the run is italic.
public Nullable<UnderlineValues> Underline { get; set; } #Gets or sets the underline style for the run.
public Boolean DoNotCheckSpellingOrGrammar { get; set; } #Gets or sets a value indicating whether spelling and grammar checks are disabled.
public Nullable<Int32> Spacing { get; set; } #Gets or sets the character spacing value in twentieths of a point.
public Boolean Strike { get; set; } #Gets or sets a value indicating whether the run is struck through.
public Boolean DoubleStrike { get; set; } #Gets or sets a value indicating whether the run has a double strikethrough.
public Boolean Outline { get; set; } #Gets or sets a value indicating whether the run text is outlined.
public Boolean Shadow { get; set; } #Gets or sets a value indicating whether the run has a shadow effect.
public Boolean Emboss { get; set; } #Gets or sets a value indicating whether the run is embossed.
public Nullable<Int32> FontSize { get; set; } #Gets or sets the font size in points.
public Nullable<Color> Color { get; set; } #Gets or sets the text color using Color.
public String ColorHex { get; set; } #Gets or sets the text color as a hexadecimal string.
public Nullable<ThemeColorValues> ThemeColor { get; set; } #Gets or sets the theme color applied to the run.
public Nullable<HighlightColorValues> Highlight { get; set; } #Gets or sets the highlight color applied to the run.
public CapsStyle 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 Nullable<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 String ShadingFillColorHex { get; set; } #Get or set the paragraph shading fill color using hexadecimal value.
public Nullable<Color> ShadingFillColor { get; set; } #Get or set the paragraph shading fill color.
public Nullable<ShadingPatternValues> ShadingPattern { get; set; } #Get or set the paragraph shading pattern.
Extension Methods
public static String ToXml(WordParagraph paragraph) #StringReturns the raw Open XML string representing the paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to convert.
Returns
Outer XML of the underlying Open XML element.