API Reference

Class

WordSection

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

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.

Accepted by parameters

Methods

public WordSection AddEndnoteProperties(Nullable<WordNumberFormat> numberingFormat = null, Nullable<WordEndnotePosition> position = null, Nullable<WordNoteNumberRestart> restartNumbering = null, Nullable<Int32> startNumber = null) #
Returns: WordSection

Configures endnote properties for the section.

Parameters

numberingFormat System.Nullable{OfficeIMO.Word.WordNumberFormat} = null optionalposition: 0
Numbering format.
position System.Nullable{OfficeIMO.Word.WordEndnotePosition} = null optionalposition: 1
Endnote position.
restartNumbering System.Nullable{OfficeIMO.Word.WordNoteNumberRestart} = null optionalposition: 2
Restart numbering option.
startNumber System.Nullable{System.Int32} = null optionalposition: 3
Starting number.

Returns

The current section.

AddFooterParagraph 2 overloads
public WordParagraph AddFooterParagraph(String text, WordHeaderFooterType type, Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Adds a paragraph to the section footer of the requested type.

Parameters

text System.String requiredposition: 0
type OfficeIMO.Word.WordHeaderFooterType requiredposition: 1
removeExistingParagraphs System.Boolean = false optionalposition: 2
public WordParagraph AddFooterParagraph(String text = "", Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Adds a paragraph to the default section footer.

Parameters

text System.String = "" optionalposition: 0
Paragraph text.
removeExistingParagraphs System.Boolean = false optionalposition: 1
True to clear existing paragraphs.
public WordSection AddFootnoteProperties(Nullable<WordNumberFormat> numberingFormat = null, Nullable<WordFootnotePosition> position = null, Nullable<WordNoteNumberRestart> restartNumbering = null, Nullable<Int32> startNumber = null) #
Returns: WordSection

Configures footnote properties for the section.

Parameters

numberingFormat System.Nullable{OfficeIMO.Word.WordNumberFormat} = null optionalposition: 0
Numbering format.
position System.Nullable{OfficeIMO.Word.WordFootnotePosition} = null optionalposition: 1
Footnote position.
restartNumbering System.Nullable{OfficeIMO.Word.WordNoteNumberRestart} = null optionalposition: 2
Restart numbering option.
startNumber System.Nullable{System.Int32} = null optionalposition: 3
Starting number.

Returns

The current section.

AddHeaderParagraph 2 overloads
public WordParagraph AddHeaderParagraph(String text, WordHeaderFooterType type, Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Adds a paragraph to the section header of the requested type.

Parameters

text System.String requiredposition: 0
type OfficeIMO.Word.WordHeaderFooterType requiredposition: 1
removeExistingParagraphs System.Boolean = false optionalposition: 2
public WordParagraph AddHeaderParagraph(String text = "", Boolean removeExistingParagraphs = false) #
Returns: WordParagraph

Adds a paragraph to the default section header.

Parameters

text System.String = "" optionalposition: 0
Paragraph text.
removeExistingParagraphs System.Boolean = false optionalposition: 1
True to clear existing paragraphs.
public Void AddHeadersAndFooters() #
Returns: Void

Adds default headers and footers to the section.

public WordParagraph AddHorizontalLine(Nullable<WordBorderStyle> lineType = null, Nullable<OfficeColor> color = null, UInt32 size = 12, UInt32 space = 1) #
Returns: WordParagraph

Inserts a horizontal line paragraph into the section.

Parameters

lineType System.Nullable{OfficeIMO.Word.WordBorderStyle} = null optionalposition: 0
Border style of the line.
color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null optionalposition: 1
Line color.
size System.UInt32 = 12 optionalposition: 2
Line width.
space System.UInt32 = 1 optionalposition: 3
Line spacing.

Returns

The paragraph containing the line.

AddHyperLink 2 overloads
public WordImage AddImageVml(String filePathImage, Nullable<Double> width = null, Nullable<Double> height = null) #
Returns: WordImage

Adds a VML image to the section.

Parameters

filePathImage System.String requiredposition: 0
Path to the image file to embed.
width System.Nullable{System.Double} = null optionalposition: 1
Optional image width in points.
height System.Nullable{System.Double} = null optionalposition: 2
Optional image height in points.
public WordSection AddPageNumbering(Nullable<Int32> startNumber = null, Nullable<WordNumberFormat> format = null) #
Returns: WordSection

Adds or updates page numbering for the section.

Parameters

startNumber System.Nullable{System.Int32} = null optionalposition: 0
Starting page number.
format System.Nullable{OfficeIMO.Word.WordNumberFormat} = null optionalposition: 1
Number format.

Returns

The current section.

AddParagraph 2 overloads
public WordParagraph AddParagraph(Boolean newRun) #
Returns: WordParagraph

Adds a new paragraph to the section.

Parameters

newRun System.Boolean requiredposition: 0
Whether to create a run within the paragraph.

Returns

The created paragraph.

public WordParagraph AddParagraph(String text = "") #
Returns: WordParagraph

Adds a new paragraph containing the specified text.

Parameters

text System.String = "" optionalposition: 0
Text to place in the paragraph.

Returns

The created paragraph.

AddShape 2 overloads
public WordShape AddShape(WordShapeType shapeType, Double widthPt, Double heightPt, String fillColor = "#FFFFFF", String strokeColor = "#000000", Double strokeWeightPt = 1, Double arcSize = 0.25) #
Returns: WordShape

Adds a VML shape to the section.

Parameters

shapeType OfficeIMO.Word.WordShapeType requiredposition: 0
Type of shape to create.
widthPt System.Double requiredposition: 1
Width in points or line end X.
heightPt System.Double requiredposition: 2
Height in points or line end Y.
fillColor System.String = "#FFFFFF" optionalposition: 3
Fill color specified as a hex string (for example, #RRGGBB).
strokeColor System.String = "#000000" optionalposition: 4
Stroke color specified as a hex string (for example, #RRGGBB).
strokeWeightPt System.Double = 1 optionalposition: 5
Stroke weight in points.
arcSize System.Double = 0.25 optionalposition: 6
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) #
Returns: WordShape

Adds a VML shape to the section using OfficeColor values.

Parameters

arg1 OfficeIMO.Word.WordShapeType requiredposition: 0
arg2 System.Double requiredposition: 1
arg3 System.Double requiredposition: 2
arg4 OfficeIMO.Drawing.OfficeColor requiredposition: 3
arg5 OfficeIMO.Drawing.OfficeColor requiredposition: 4
arg6 System.Double = 1 optionalposition: 5
arg7 System.Double = 0.25 optionalposition: 6
public WordShape AddShapeDrawing(WordShapeType shapeType, Double widthPt, Double heightPt) #
Returns: WordShape

Adds a DrawingML shape to the section.

Parameters

shapeType OfficeIMO.Word.WordShapeType requiredposition: 0
Type of shape to create.
widthPt System.Double requiredposition: 1
Width in points.
heightPt System.Double requiredposition: 2
Height in points.
public WordSmartArt AddSmartArt(WordSmartArtType type) #
Returns: WordSmartArt

Inserts a SmartArt diagram into this section.

Parameters

type OfficeIMO.Word.WordSmartArtType requiredposition: 0
Layout type of the SmartArt.

Returns

The created WordSmartArt.

public WordTable AddTable(Int32 rows, Int32 columns, WordTableStyle tableStyle = TableGrid) #
Returns: WordTable

Adds a table to the section.

Parameters

rows System.Int32 requiredposition: 0
Number of rows.
columns System.Int32 requiredposition: 1
Number of columns.
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optionalposition: 2
Table style to apply.
public WordTextBox AddTextBox(String text, WordImageTextWrapping wrapTextImage = Square) #
Returns: WordTextBox

Adds a text box paragraph to the section.

Parameters

text System.String requiredposition: 0
Initial text inside the text box.
wrapTextImage OfficeIMO.Word.WordImageTextWrapping = Square optionalposition: 1
Wrapping style.

Returns

The created WordTextBox.

public WordTextBox AddTextBoxVml(String text) #
Returns: WordTextBox

Adds a VML text box paragraph to the section.

Parameters

text System.String requiredposition: 0
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) #
Returns: WordWatermark

Adds a watermark to the section.

Parameters

watermarkStyle OfficeIMO.Word.WordWatermarkStyle requiredposition: 0
Watermark style.
textOrFilePath System.String requiredposition: 1
Text or image file path.
horizontalOffset System.Nullable{System.Double} = null optionalposition: 2
Horizontal offset in points.
verticalOffset System.Nullable{System.Double} = null optionalposition: 3
Vertical offset in points.
scale System.Double = 1 optionalposition: 4
Scale factor for width and height.

Returns

The created WordWatermark instance.

public WordSection CloneSection() #
Returns: WordSection

Creates a copy of this section and inserts it after the current section.

Returns

The cloned WordSection.

GetFooter 2 overloads
public WordFooter GetFooter(WordHeaderFooterType type) #
Returns: WordFooter

Returns the section footer of the requested type (Default/Even/First).

Parameters

type OfficeIMO.Word.WordHeaderFooterType requiredposition: 0
public WordFooter GetFooter() #
Returns: WordFooter

Returns the default section footer.

GetHeader 2 overloads
public WordHeader GetHeader(WordHeaderFooterType type) #
Returns: WordHeader

Returns the section header of the requested type (Default/Even/First).

Parameters

type OfficeIMO.Word.WordHeaderFooterType requiredposition: 0
public WordHeader GetHeader() #
Returns: WordHeader

Returns the default section header.

public WordFooter GetOrCreateFooter(WordHeaderFooterType type) #
Returns: WordFooter

Returns an existing footer of the requested type or creates it if missing. Behavior mirrors WordHeaderFooterType).

Parameters

type OfficeIMO.Word.WordHeaderFooterType requiredposition: 0
public WordHeader GetOrCreateHeader(WordHeaderFooterType type) #
Returns: WordHeader

Returns an existing header of the requested type or creates it if missing. For Default, this ensures default header/footer parts exist. For First and Even, this toggles the appropriate section option which provisions the corresponding parts and settings.

Parameters

type OfficeIMO.Word.WordHeaderFooterType requiredposition: 0
public Void RemoveSection() #
Returns: Void

Removes this section and all of its content from the document, cleaning up numbering and any unreferenced header and footer parts.

public Void RemoveWatermark() #
Returns: Void

Removes all watermarks from this section including headers.

public WordSection SetBorders(WordBorder wordBorder) #
Returns: WordSection

Applies border settings to the section.

Parameters

wordBorder OfficeIMO.Word.WordBorder requiredposition: 0
Border preset to apply.

Returns

The current section.

public WordSection SetMargins(WordMargin pageMargins) #
Returns: WordSection

Updates the margins for this section.

Parameters

pageMargins OfficeIMO.Word.WordMargin requiredposition: 0
Margin values to apply.

Returns

The current section.

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

Extension Methods

public static Void AddHeadersAndFooters(WordSection section) #
Returns: Void

Add default header and footers to section. You can control odd/even/first with DifferentOddAndEventPages/DifferentFirstPage properties.

Parameters

section OfficeIMO.Word.WordSection requiredposition: 0