Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordDocumentScope

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
22fb5b2be3d2 with working tree changes
Modifiers
sealed

Edits one WordDocument: its fluent methods and keywords, each returning this scope.

Inheritance

  • object
  • WordDocumentScope

Usage

Explore 45 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 44

Accepted by parameters 1

Methods

public WordDocumentScope ApplicationProperties(Action<WordApplicationProperties> configure) #

Configures WordDocument.ApplicationProperties in place: Manages application related properties.

Parameters

configure System.Action<OfficeIMO.Word.WordApplicationProperties> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope AutoUpdateToc(bool value = true) #

Sets WordDocument.AutoUpdateToc: When true the table of contents is flagged to update before saving.

Parameters

value bool = true optional
The value; true when omitted.

Returns

WordDocumentScope The same scope.
Background 2 overloads
public WordDocumentScope Background(WordBackground value) #

Sets WordDocument.Background: Provides access to the document background settings.

Parameters

value OfficeIMO.Word.WordBackground required
The value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Background(Action<WordBackground> configure) #

Configures WordDocument.Background in place: Provides access to the document background settings.

Parameters

configure System.Action<OfficeIMO.Word.WordBackground> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Bookmark(string bookmarkName, Action<WordBookmarkScope>? configure = null) #

Inserts a bookmark in a new paragraph.

Parameters

bookmarkName string required
Name of the bookmark.
configure System.Action<OfficeIMO.Word.WordBookmarkScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
Borders 2 overloads
public WordDocumentScope Borders(WordBorders value) #

Sets WordDocument.Borders: Gets or sets the page borders for the first section.

Parameters

value OfficeIMO.Word.WordBorders required
The value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Borders(Action<WordBorders> configure) #

Configures WordDocument.Borders in place: Gets or sets the page borders for the first section.

Parameters

configure System.Action<OfficeIMO.Word.WordBorders> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Break(WordBreakType? breakType = null, Action<WordParagraphScope>? configure = null) #

Inserts a break into the document.

Parameters

breakType OfficeIMO.Word.WordBreakType? = null optional
Type of break to insert.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Callout(OfficeCalloutKind kind, string title, string body, OfficeTheme? theme = null, Action<WordParagraphScope>? configure = null) #

Adds a shaded callout title and body, returning its title paragraph.

Parameters

kind OfficeIMO.OfficeCalloutKind required
The value.
title string required
The value.
body string required
The value.
theme OfficeIMO.OfficeTheme? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
Chart 2 overloads
public WordDocumentScope Chart(WordChart item) #

Adds an item to WordDocument.Charts: Provides a list of the charts in the document body. WordDocument.AllCharts also lists header, footer, footnote and endnote charts.

Parameters

item OfficeIMO.Word.WordChart required
The item.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Chart(OfficeChartType chartKind, OfficeChartData data, OfficeChartOptions? options = null, Action<WordChartScope>? configure = null) #

Creates an editable native chart and embedded worksheet from the shared OfficeIMO chart contract.

Parameters

chartKind OfficeIMO.OfficeChartType required
Default chart family, with optional per-series kinds for supported combinations.
data OfficeIMO.Drawing.OfficeChartData required
Categories, series, and their supported appearance.
options OfficeIMO.OfficeChartOptions? = null optional
Optional title, physical size and Word frame options. The default size is 600 by 600 pixels.
configure System.Action<OfficeIMO.Word.WordChartScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Charts(IEnumerable<WordChart> items) #

Adds items to WordDocument.Charts: Provides a list of the charts in the document body. WordDocument.AllCharts also lists header, footer, footnote and endnote charts.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordChart> required
The items, in order.

Returns

WordDocumentScope The same scope.
public WordDocumentScope CodeBlock(string code, string? language = null, Action<WordParagraphScope>? configure = null) #

Adds a code paragraph using a named monospace paragraph style. The language is a descriptive hint.

Parameters

code string required
The value.
language string? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
CompatibilitySettings 2 overloads
public WordDocumentScope CompatibilitySettings(WordCompatibilitySettings value) #

Sets WordDocument.CompatibilitySettings: Gets or sets compatibility settings for the document.

Parameters

value OfficeIMO.Word.WordCompatibilitySettings required
The value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope CompatibilitySettings(Action<WordCompatibilitySettings> configure) #

Configures WordDocument.CompatibilitySettings in place: Gets or sets compatibility settings for the document.

Parameters

configure System.Action<OfficeIMO.Word.WordCompatibilitySettings> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope CoverPageProperties(Action<WordCoverPageProperties> configure) #

Configures WordDocument.CoverPageProperties in place: Provides access to the cover page properties custom XML part used by built-in templates.

Parameters

configure System.Action<OfficeIMO.Word.WordCoverPageProperties> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope EndnoteSettings(Action<WordEndnoteSettings> configure) #

Configures WordDocument.EndnoteSettings in place: Gets the editable configuration of the first section's endnote configuration.

Parameters

configure System.Action<OfficeIMO.Word.WordEndnoteSettings> required
Configures the value.

Returns

WordDocumentScope The same scope.
Equation 2 overloads
public WordDocumentScope Equation(OfficeMathExpression expression, Action<WordEquationScope>? configure = null) #

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

Parameters

expression OfficeIMO.Drawing.OfficeMathExpression required
The value.
configure System.Action<OfficeIMO.Word.WordEquationScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Equation(string omml, Action<WordEquationScope>? configure = null) #

Inserts an equation specified in OMML format.

Parameters

omml string required
OMML markup for the equation.
configure System.Action<OfficeIMO.Word.WordEquationScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
Field 3 overloads
public WordDocumentScope Field(WordFieldType wordFieldType, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, List<string>? parameters = null, Action<WordFieldScope>? configure = null) #

Adds a field to the document in a new paragraph.

Parameters

wordFieldType OfficeIMO.Word.WordFieldType required
Type of field to insert.
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
Whether to use advanced formatting.
parameters System.Collections.Generic.List<string>? = null optional
Additional switch parameters.
configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Field(WordFieldCode fieldCode, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, Action<WordFieldScope>? configure = null) #

Adds a field represented by a WordFieldCode to the document in a new paragraph.

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
Whether to use advanced formatting.
configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Field(WordFieldBuilder builder, bool advanced = false, Action<WordFieldScope>? configure = null) #

Adds a field built using WordFieldBuilder.

Parameters

builder OfficeIMO.Word.WordFieldBuilder required
Field builder instance.
advanced bool = false optional
Whether to use advanced formatting.
configure System.Action<OfficeIMO.Word.WordFieldScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope FootNote(WordFootNote item) #

Adds an item to WordDocument.FootNotes: Collection of all footnotes referenced throughout the document.

Parameters

item OfficeIMO.Word.WordFootNote required
The item.

Returns

WordDocumentScope The same scope.
public WordDocumentScope FootNotes(IEnumerable<WordFootNote> items) #

Adds items to WordDocument.FootNotes: Collection of all footnotes referenced throughout the document.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordFootNote> required
The items, in order.

Returns

WordDocumentScope The same scope.
public WordDocumentScope FootnoteSettings(Action<WordFootnoteSettings> configure) #

Configures WordDocument.FootnoteSettings in place: Gets the editable configuration of the first section's footnote configuration.

Parameters

configure System.Action<OfficeIMO.Word.WordFootnoteSettings> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Header(Action<WordHeaderScope> configure) #

Configures the default header of the first section, creating it when missing.

Parameters

configure System.Action<OfficeIMO.Word.WordHeaderScope> required
Composes the header.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Heading(string text, int level = 1, Action<WordParagraphScope>? configure = null) #

Adds a heading paragraph using the document's built-in heading style.

Parameters

text string required
Heading text.
level int = 1 optional
Heading level from one through nine.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope HorizontalLine(WordBorderStyle? lineType = null, OfficeColor? color = null, uint size = 12, uint space = 1, Action<WordParagraphScope>? configure = null) #

Inserts a horizontal line into the document.

Parameters

lineType OfficeIMO.Word.WordBorderStyle? = null optional
Border style of the line.
color OfficeIMO.OfficeColor? = null optional
Line color.
size uint = 12 optional
Line width in eighths of a point.
space uint = 1 optional
Space above and below the line.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
HyperLink 2 overloads
Image 2 overloads
public WordDocumentScope Image(string path, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null, Action<WordImageScope>? configure = null) #

Adds an image in a new paragraph and returns its editable occurrence.

Parameters

path string required
The value.
width OfficeIMO.OfficeLength? = null optional
The value.
height OfficeIMO.OfficeLength? = null optional
The value.
options OfficeIMO.Word.WordImageOptions? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordImageScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Image(Stream stream, OfficeLength? width = null, OfficeLength? height = null, WordImageOptions? options = null, Action<WordImageScope>? configure = null) #

Adds an image stream in a new paragraph without disposing the caller's stream.

Parameters

stream System.IO.Stream required
The value.
width OfficeIMO.OfficeLength? = null optional
The value.
height OfficeIMO.OfficeLength? = null optional
The value.
options OfficeIMO.Word.WordImageOptions? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordImageScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope List(WordListStyle style, Action<WordListScope>? configure = null) #

Creates a list using one of the built-in numbering styles. For manually configured lists prefer WordDocument.AddCustomList.

Parameters

style OfficeIMO.Word.WordListStyle required
The value.
configure System.Action<OfficeIMO.Word.WordListScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope PageBreak(Action<WordParagraphScope>? configure = null) #

Inserts a page break into the document.

Parameters

configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope PageNumberSettings(Action<WordPageNumberSettings> configure) #

Configures WordDocument.PageNumberSettings in place: Gets the editable configuration of the first section's page-numbering configuration.

Parameters

configure System.Action<OfficeIMO.Word.WordPageNumberSettings> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope PageSetup(Action<WordPageSetupScope> configure) #

Gets the page size, margins, orientation and running headers and footers of the first section.

Parameters

configure System.Action<OfficeIMO.Word.WordPageSetupScope> required
Configures it through its scope.

Returns

WordDocumentScope The same scope.
Paragraph 3 overloads
public WordDocumentScope Paragraph(Action<WordParagraphScope> configure) #

Adds a paragraph at the end of the document and composes it.

Parameters

configure System.Action<OfficeIMO.Word.WordParagraphScope> required
Adds text runs and formats the paragraph.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Paragraph(WordParagraph item) #

Adds an item to WordDocument.Paragraphs: Returns all paragraphs from every section of the document.

Parameters

item OfficeIMO.Word.WordParagraph required
The item.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Paragraph(string text, Action<WordParagraphScope>? configure = null) #

Adds a new paragraph containing the specified text.

Parameters

text string required
Text for the paragraph.
configure System.Action<OfficeIMO.Word.WordParagraphScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Paragraphs(IEnumerable<WordParagraph> items) #

Adds items to WordDocument.Paragraphs: Returns all paragraphs from every section of the document.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordParagraph> required
The items, in order.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Properties(Action<WordBuiltinDocumentProperties> configure) #

Configures WordDocument.Properties in place: Provides access to built-in document properties.

Parameters

configure System.Action<OfficeIMO.Word.WordBuiltinDocumentProperties> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope RtlGutter(bool value = true) #

Sets WordDocument.RtlGutter: Gets or sets a value indicating whether the gutter should appear on the right for right-to-left pages in the first section.

Parameters

value bool = true optional
The value; true when omitted.

Returns

WordDocumentScope The same scope.
Section 3 overloads
public WordDocumentScope Section(WordSection item) #

Adds an item to WordDocument.Sections: Collection of sections contained in the document.

Parameters

item OfficeIMO.Word.WordSection required
The item.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Section(WordSectionBreakType breakType, Action<WordSectionScope>? configure = null) #

Adds a new section using the specified OfficeIMO break type.

Parameters

breakType OfficeIMO.Word.WordSectionBreakType required
Section break type.
configure System.Action<OfficeIMO.Word.WordSectionScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Section(Action<WordSectionScope>? configure = null) #

Adds a new section using the document default break behavior.

Parameters

configure System.Action<OfficeIMO.Word.WordSectionScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Sections(IEnumerable<WordSection> items) #

Adds items to WordDocument.Sections: Collection of sections contained in the document.

Parameters

items System.Collections.Generic.IEnumerable<OfficeIMO.Word.WordSection> required
The items, in order.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Settings(Action<WordSettings> configure) #

Configures WordDocument.Settings in place: Provides access to document settings. A missing settings part is created on first use.

Parameters

configure System.Action<OfficeIMO.Word.WordSettings> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Shape(WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null, OfficeColor? strokeColor = null, OfficeLength? strokeWeight = null, double arcSize = 0.25, Action<WordShapeScope>? configure = null) #

Adds a basic shape to the document in a new paragraph.

Parameters

shapeType OfficeIMO.Word.WordShapeType required
Type of shape to create.
width OfficeIMO.OfficeLength required
Width or line end X.
height OfficeIMO.OfficeLength required
Height or line end Y.
fillColor OfficeIMO.OfficeColor? = null optional
Fill color; white when omitted.
strokeColor OfficeIMO.OfficeColor? = null optional
Stroke color; black when omitted.
strokeWeight OfficeIMO.OfficeLength? = null optional
Stroke thickness; one point when omitted.
arcSize double = 0.25 optional
Corner roundness fraction for rounded rectangles.
configure System.Action<OfficeIMO.Word.WordShapeScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope SmartArt(WordSmartArtType type, Action<WordSmartArtScope>? configure = null) #

Inserts a SmartArt diagram into the document.

Parameters

type OfficeIMO.Word.WordSmartArtType required
Layout type of the SmartArt.
configure System.Action<OfficeIMO.Word.WordSmartArtScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
Table 5 overloads
public WordDocumentScope Table(Action<WordTableBuilder> compose) #

Adds a table composed row by row at the end of the document.

Parameters

compose System.Action<OfficeIMO.Word.WordTableBuilder> required
Sets the columns, header and rows.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Table(IEnumerable<object?> items, OfficeTableOptions? options = null, Action<WordTableScope>? configure = null) #

Adds a table from runtime objects by projecting their public properties or dictionary keys into columns.

Parameters

items System.Collections.Generic.IEnumerable<object?> required
Objects to insert into the table. Column names come from the first item.
options OfficeIMO.OfficeTableOptions? = null optional
Column selection, ordering, header, formatting, alignment, name and caption options.
configure System.Action<OfficeIMO.Word.WordTableScope>? = null optional
Edits the created table.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Table(int rows, int columns, WordTableStyle tableStyle = TableGrid, Action<WordTableScope>? configure = null) #

Adds a table to the end of the document body.

Parameters

rows int required
Number of rows to create.
columns int required
Number of columns to create.
tableStyle OfficeIMO.Word.WordTableStyle = TableGrid optional
Optional table style to apply.
configure System.Action<OfficeIMO.Word.WordTableScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Table(object?[,] values, OfficeTableOptions? options = null, Action<WordTableScope>? configure = null) #

Adds an editable table from an existing rectangular matrix.

Parameters

values object?[,] required
The value.
options OfficeIMO.OfficeTableOptions? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordTableScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Table(IEnumerable<string[]> rows, OfficeTableOptions? options = null, Action<WordTableScope>? configure = null) #

Adds existing array rows as table cells. The first row is the header when headers are enabled.

Parameters

rows System.Collections.Generic.IEnumerable<string[]> required
The value.
options OfficeIMO.OfficeTableOptions? = null optional
The value.
configure System.Action<OfficeIMO.Word.WordTableScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope TableOfContent(Action<WordTableOfContent> configure) #

Configures WordDocument.TableOfContent in place: Gets the table of contents defined in the document.

Parameters

configure System.Action<OfficeIMO.Word.WordTableOfContent> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope TableOfContents(WordTableOfContentsStyle tableOfContentStyle = Template1, int minLevel = 1, int maxLevel = 3, string? title = null, bool insertAtTop = false, Action<WordTableOfContentScope>? configure = null) #

Adds a table of contents to the current document.

Parameters

tableOfContentStyle OfficeIMO.Word.WordTableOfContentsStyle = Template1 optional
Optional style to use when creating the table of contents.
minLevel int = 1 optional
Minimum heading level to include (1..9).
maxLevel int = 3 optional
Maximum heading level to include (1..9).
title string? = null optional
Optional title replacing the template title.
insertAtTop bool = false optional
Places the table of contents before existing body content.
configure System.Action<OfficeIMO.Word.WordTableOfContentScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope TextBox(string text, WordImageTextWrapping wrapTextImage = Square, Action<WordTextBoxScope>? configure = null) #

Inserts a text box into the document.

Parameters

text string required
Initial text for the text box.
wrapTextImage OfficeIMO.Word.WordImageTextWrapping = Square optional
Text wrapping option.
configure System.Action<OfficeIMO.Word.WordTextBoxScope>? = null optional
Configures the new item through its scope.

Returns

WordDocumentScope The same scope.
public WordDocumentScope Theme(Action<WordTheme> configure) #

Configures WordDocument.Theme in place: Gets the document theme: its colour scheme and its heading and body fonts.

Parameters

configure System.Action<OfficeIMO.Word.WordTheme> required
Configures the value.

Returns

WordDocumentScope The same scope.
public WordDocumentScope TrackChanges(bool value = true) #

Sets WordDocument.TrackChanges: Enable or disable tracking of all revisions, moves and formatting changes.

Parameters

value bool = true optional
The value; true when omitted.

Returns

WordDocumentScope The same scope.
public WordDocumentScope VbaProject(OfficeVbaProject project, OfficeVbaWriteOptions? options = null) #

Applies a native source project while preserving Word's VBA data and requiring explicit signature removal.

Parameters

project OfficeIMO.OfficeVbaProject required
The value.
options OfficeIMO.OfficeVbaWriteOptions? = null optional
The value.

Returns

WordDocumentScope The same scope.

Properties

public WordDocument Model { get; } #

The WordDocument this scope edits, for plain C# inside a lambda.