API Reference
WordSection
Represents a section within a Word document.
Inheritance
- Object
- WordSection
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Property SectionBuilder.Section
- Method WordFluentDocument.Sections
- Method WordDocument.AddSection
- Method WordDocument.AddSection
- Method WordDocument.CloneSection
- Property WordDocument.Sections
- Method WordDocumentTraversal.EnumerateSections
- Method WordMargins.SetMargins
- Method WordSection.AddEndnoteProperties
- Method WordSection.AddFootnoteProperties
- Method WordSection.AddPageNumbering
- Method WordSection.CloneSection
- Method WordSection.SetBorders
- Method WordSection.SetMargins
Accepted by parameters
- Method WordFluentDocument.ForEachSection
- Method WordHeadersAndFooters.AddHeadersAndFooters
- Constructor WordMargins.WordMargins
- Method WordMargins.SetMargins
- Constructor WordPageSizes.WordPageSizes
- Method WordParagraph.AddParagraphAfterSelf
- Extension method WordSection.AddHeadersAndFooters
- Constructor WordWatermark.WordWatermark
- Constructor WordWatermark.WordWatermark
Methods
public WordSection AddEndnoteProperties(Nullable<WordNumberFormat> numberingFormat = null, Nullable<WordEndnotePosition> position = null, Nullable<WordNoteNumberRestart> restartNumbering = null, Nullable<Int32> startNumber = null) #WordSectionConfigures endnote properties for the section.
Parameters
- numberingFormat System.Nullable{OfficeIMO.Word.WordNumberFormat} = null
- Numbering format.
- position System.Nullable{OfficeIMO.Word.WordEndnotePosition} = null
- Endnote position.
- restartNumbering System.Nullable{OfficeIMO.Word.WordNoteNumberRestart} = null
- Restart numbering option.
- startNumber System.Nullable{System.Int32} = null
- Starting number.
Returns
The current section.
public WordSection AddFootnoteProperties(Nullable<WordNumberFormat> numberingFormat = null, Nullable<WordFootnotePosition> position = null, Nullable<WordNoteNumberRestart> restartNumbering = null, Nullable<Int32> startNumber = null) #WordSectionConfigures footnote properties for the section.
Parameters
- numberingFormat System.Nullable{OfficeIMO.Word.WordNumberFormat} = null
- Numbering format.
- position System.Nullable{OfficeIMO.Word.WordFootnotePosition} = null
- Footnote position.
- restartNumbering System.Nullable{OfficeIMO.Word.WordNoteNumberRestart} = null
- Restart numbering option.
- startNumber System.Nullable{System.Int32} = null
- Starting number.
Returns
The current section.
public WordParagraph AddHeaderParagraph(String text = "", Boolean removeExistingParagraphs = false) #WordParagraphAdds a paragraph to the default section header.
Parameters
- text System.String = ""
- Paragraph text.
- removeExistingParagraphs System.Boolean = false
- True to clear existing paragraphs.
public WordParagraph AddHorizontalLine(Nullable<WordBorderStyle> lineType = null, Nullable<OfficeColor> color = null, UInt32 size = 12, UInt32 space = 1) #WordParagraphInserts a horizontal line paragraph into the section.
Parameters
- lineType System.Nullable{OfficeIMO.Word.WordBorderStyle} = null
- Border style of the line.
- color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null
- Line color.
- size System.UInt32 = 12
- Line width.
- space System.UInt32 = 1
- Line spacing.
Returns
The paragraph containing the line.
public WordParagraph AddHyperLink(String text, Uri uri, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdds a hyperlink paragraph pointing to a URI.
Parameters
- text System.String
- Display text.
- uri System.Uri
- Target URI.
- addStyle System.Boolean = false
- Whether to apply hyperlink style.
- tooltip System.String = ""
- Optional tooltip.
- history System.Boolean = true
- Add to document history.
Returns
The created paragraph.
public WordParagraph AddHyperLink(String text, String anchor, Boolean addStyle = false, String tooltip = "", Boolean history = true) #WordParagraphAdds a hyperlink paragraph pointing to an internal anchor.
Parameters
- text System.String
- Display text.
- anchor System.String
- Bookmark anchor name.
- addStyle System.Boolean = false
- Whether to apply hyperlink style.
- tooltip System.String = ""
- Optional tooltip.
- history System.Boolean = true
- Add to document history.
Returns
The created paragraph.
public WordImage AddImageVml(String filePathImage, Nullable<Double> width = null, Nullable<Double> height = null) #WordImageAdds a VML image to the section.
Parameters
- filePathImage System.String
- Path to the image file to embed.
- width System.Nullable{System.Double} = null
- Optional image width in points.
- height System.Nullable{System.Double} = null
- Optional image height in points.
public WordSection AddPageNumbering(Nullable<Int32> startNumber = null, Nullable<WordNumberFormat> format = null) #WordSectionAdds or updates page numbering for the section.
Parameters
- startNumber System.Nullable{System.Int32} = null
- Starting page number.
- format System.Nullable{OfficeIMO.Word.WordNumberFormat} = null
- Number format.
Returns
The current section.
public WordParagraph AddParagraph(Boolean newRun) #WordParagraphAdds a new paragraph to the section.
Parameters
- newRun System.Boolean
- Whether to create a run within the paragraph.
Returns
The created paragraph.
public WordParagraph AddParagraph(String text = "") #WordParagraphAdds a new paragraph containing the specified text.
Parameters
- text System.String = ""
- Text to place in the paragraph.
Returns
The created paragraph.
public WordShape AddShape(WordShapeType shapeType, Double widthPt, Double heightPt, String fillColor = "#FFFFFF", String strokeColor = "#000000", Double strokeWeightPt = 1, Double arcSize = 0.25) #WordShapeAdds a VML shape to the section.
Parameters
- shapeType OfficeIMO.Word.WordShapeType
- 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 specified as a hex string (for example, #RRGGBB).
- strokeColor System.String = "#000000"
- Stroke color specified as a hex string (for example, #RRGGBB).
- strokeWeightPt System.Double = 1
- Stroke weight in points.
- arcSize System.Double = 0.25
- Rounded corner size expressed as a fraction between 0 and 1.
public WordShape AddShape(WordShapeType shapeType, Double widthPt, Double heightPt, OfficeColor fillColor, OfficeColor strokeColor, Double strokeWeightPt = 1, Double arcSize = 0.25) #WordShapeAdds a VML shape to the section using OfficeColor values.
Parameters
- arg1 OfficeIMO.Word.WordShapeType
- arg2 System.Double
- arg3 System.Double
- arg4 OfficeIMO.Drawing.OfficeColor
- arg5 OfficeIMO.Drawing.OfficeColor
- arg6 System.Double = 1
- arg7 System.Double = 0.25
public WordShape AddShapeDrawing(WordShapeType shapeType, Double widthPt, Double heightPt) #WordShapeAdds a DrawingML shape to the section.
Parameters
- shapeType OfficeIMO.Word.WordShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
public WordSmartArt AddSmartArt(WordSmartArtType type) #WordSmartArtInserts a SmartArt diagram into this section.
Parameters
- type OfficeIMO.Word.WordSmartArtType
- Layout type of the SmartArt.
Returns
The created WordSmartArt.
public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #WordTableAdds a table to the section.
Parameters
- rows System.Int32
- Number of rows.
- columns System.Int32
- Number of columns.
- tableStyle OfficeIMO.Word.WordTableStyle = TableGrid
- Table style to apply.
public WordTextBox AddTextBox(String text, WordImageTextWrapping wrapTextImage = Square) #WordTextBoxAdds a text box paragraph to the section.
Parameters
- text System.String
- Initial text inside the text box.
- wrapTextImage OfficeIMO.Word.WordImageTextWrapping = Square
- Wrapping style.
Returns
The created WordTextBox.
public WordTextBox AddTextBoxVml(String text) #WordTextBoxAdds a VML text box paragraph to the section.
Parameters
- text System.String
- Initial text content inserted into the VML text box.
public WordWatermark AddWatermark(WordWatermarkStyle watermarkStyle, String textOrFilePath, Nullable<Double> horizontalOffset = null, Nullable<Double> verticalOffset = null, Double scale = 1) #WordWatermarkAdds a watermark to the section.
Parameters
- watermarkStyle OfficeIMO.Word.WordWatermarkStyle
- Watermark style.
- textOrFilePath System.String
- Text or image file path.
- horizontalOffset System.Nullable{System.Double} = null
- Horizontal offset in points.
- verticalOffset System.Nullable{System.Double} = null
- Vertical offset in points.
- scale System.Double = 1
- Scale factor for width and height.
Returns
The created WordWatermark instance.
public WordSection CloneSection() #WordSectionCreates a copy of this section and inserts it after the current section.
Returns
The cloned WordSection.
public Void RemoveSection() #VoidRemoves this section and all of its content from the document, cleaning up numbering and any unreferenced header and footer parts.
public Void RemoveWatermark() #VoidRemoves all watermarks from this section including headers.
public WordSection SetBorders(WordBorder wordBorder) #WordSectionApplies border settings to the section.
Parameters
- wordBorder OfficeIMO.Word.WordBorder
- Border preset to apply.
Returns
The current section.
public WordSection SetMargins(WordMargin pageMargins) #WordSectionUpdates the margins for this section.
Parameters
- pageMargins OfficeIMO.Word.WordMargin
- Margin values to apply.
Returns
The current section.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public List<WordElement> Elements { get; } #Provides a list of all elements within the section including paragraphs, tables, images, etc.
public List<WordElement> ElementsByType { get; } #Provides a list of all elements within the section including paragraphs, tables, images, etc.
public List<WordParagraph> Paragraphs { get; } #Provides a list of all paragraphs within the section
public List<WordParagraph> ParagraphsPageBreaks { get; } #Provides a list of all paragraphs with page breaks within the section
public List<WordParagraph> ParagraphsBreaks { get; } #Provides a list of all paragraphs with breaks within the section
public List<WordParagraph> ParagraphsHyperLinks { get; } #Provides a list of paragraphs that contain hyperlinks.
public List<WordParagraph> ParagraphsFields { get; } #Provides a list of paragraphs that contain fields.
public List<WordParagraph> ParagraphsBookmarks { get; } #Provides a list of paragraphs that contain Bookmarks
public List<WordParagraph> ParagraphsEquations { get; } #Provies a list of paragraphs that contain Equations
public List<WordParagraph> ParagraphsTabs { get; } #Provies a list of paragraphs that contain Tabs
public List<WordParagraph> ParagraphsTabStops { get; } #Provides a list of paragraphs that contain TabStops
public List<WordParagraph> ParagraphsStructuredDocumentTags { get; } #Provides a list of paragraphs that contain Structured Document Tags
public List<WordParagraph> ParagraphsCheckBoxes { get; } #Provides a list of paragraphs that contain checkbox controls
public List<WordParagraph> ParagraphsDatePickers { get; } #Provides a list of paragraphs that contain date picker controls
public List<WordParagraph> ParagraphsDropDownLists { get; } #Provides a list of paragraphs that contain dropdown list controls
public List<WordParagraph> ParagraphsComboBoxes { get; } #Provides a list of paragraphs that contain combo box controls
public List<WordParagraph> ParagraphsPictureControls { get; } #Provides a list of paragraphs that contain picture controls
public List<WordParagraph> ParagraphsRepeatingSections { get; } #Provides a list of paragraphs that contain repeating section controls
public List<WordParagraph> ParagraphsImages { get; } #Provides a list of paragraphs that contain Image
public List<WordParagraph> ParagraphsEmbeddedObjects { get; } #Provides a list of paragraphs that contain embedded objects.
public List<WordParagraph> ParagraphsCharts { get; } #Provides a list of paragraphs that contain charts.
public List<WordParagraph> ParagraphsEndNotes { get; } #Provides a list of paragraphs that contain end notes.
public List<WordParagraph> ParagraphsFootNotes { get; } #Provides a list of paragraphs that contain foot notes.
public List<WordParagraph> ParagraphsTextBoxes { get; } #Provides a list of paragraphs that contain text boxes.
public List<WordParagraph> ParagraphsShapes { get; } #Provides a list of paragraphs that contain shapes.
public List<WordParagraph> ParagraphsSmartArts { get; } #Provides a list of paragraphs that contain SmartArt diagrams.
public List<WordBreak> PageBreaks { get; } #Gets all page break objects within the section.
public List<WordChart> Charts { get; } #Gets all charts contained in the section.
public List<WordBreak> Breaks { get; } #Gets all line breaks within the section.
public List<WordImage> Images { get; } #Exposes Images in their Image form for easy access (saving, modifying)
public List<WordEmbeddedObject> EmbeddedObjects { get; } #Gets all embedded objects within the section.
public List<WordBookmark> Bookmarks { get; } #Gets all bookmarks defined in the section.
public List<WordField> Fields { get; } #Gets all fields within the section.
public List<WordEndNote> EndNotes { get; } #Gets all end notes within the section.
public List<WordFootNote> FootNotes { get; } #Gets all foot notes within the section.
public List<WordHyperLink> HyperLinks { get; } #Gets all hyperlinks within the section.
public List<WordTabChar> Tabs { get; } #Gets all tab characters defined in the section.
public List<WordTextBox> TextBoxes { get; } #Gets all text boxes within the section.
public List<WordShape> Shapes { get; } #Collection of shapes available within the section.
public List<WordSmartArt> SmartArts { get; } #Collection of SmartArt diagrams available within the section.
public List<WordEquation> Equations { get; } #Gets all equations within the section.
public List<WordStructuredDocumentTag> StructuredDocumentTags { get; } #Gets all structured document tags within the section.
public List<WordCheckBox> CheckBoxes { get; } #Gets all checkbox content controls within the section.
public List<WordDatePicker> DatePickers { get; } #Gets all date picker content controls within the section.
public List<WordDropDownList> DropDownLists { get; } #Gets all dropdown list content controls within the section.
public List<WordComboBox> ComboBoxes { get; } #Gets all combo box content controls within the section.
public List<WordPictureControl> PictureControls { get; } #Gets all picture content controls within the section.
public List<WordRepeatingSection> RepeatingSections { get; } #Gets all repeating section content controls within the section.
public WordHeaders Header { get; set; } #Exposes the headers available for this section.
public WordBorders Borders { get; set; } #Provides access to page border settings for this section.
public WordMargins Margins { get; set; } #Provides access to page margin settings for this section.
public WordPageSizes PageSettings { get; set; } #Provides access to page size and orientation settings for this section.
public List<WordList> Lists { get; } #Provides a list of all lists within the section
public List<WordTable> Tables { get; } #Provides a list of all tables within the section, excluding nested tables
public List<WordEmbeddedDocument> EmbeddedDocuments { get; } #Provides a list of all embedded documents within the section
public List<WordWatermark> Watermarks { get; } #Provides a list of all watermarks within the section, including any watermarks found in the section headers.
public List<WordTable> TablesIncludingNestedTables { get; } #Provides a list of all tables within the section, including nested tables
public Boolean DifferentFirstPage { get; set; } #Gets or sets a value indicating whether the first page has different headers and footers.
public Boolean DifferentOddAndEvenPages { get; set; } #Gets or sets a value indicating whether odd and even pages use separate headers and footers.
public Boolean RtlGutter { get; set; } #Gets or sets a value indicating whether the gutter should be on the right for RTL pages.
public OfficePageOrientation PageOrientation { get; set; } #Gets or sets the page orientation of the section.
public Nullable<Int32> ColumnsSpace { get; set; } #Gets or sets spacing between section columns.
public Nullable<Int32> ColumnCount { get; set; } #Gets or sets the number of columns in the section.
public Boolean HasColumnSeparator { get; set; } #Gets or sets whether a separator line is shown between section columns.
public WordPageNumberSettings PageNumberSettings { get; } #Gets an SDK-independent view of the section's page-numbering configuration.
public WordFootnoteSettings FootnoteSettings { get; } #Gets an SDK-independent view of the section's footnote configuration.
public WordEndnoteSettings EndnoteSettings { get; } #Gets an SDK-independent view of the section's endnote configuration.