Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficeWordTable

Aliases: WordTable
Module
PSWriteOffice
Aliases
WordTable
Inputs
System.Object
Outputs
OfficeIMO.Word.WordTable

Creates a table from PowerShell objects.

Syntax

Add-OfficeWordTable
[-CollectionSeparator <String>]
[[-Content] <ScriptBlock>]
[-DictionaryEntrySeparator <String>]
[-DictionaryKeyValueSeparator <String>]
[-InputObject] <Object>
[-Layout <AutoFit|Fixed|AutoFitToContents|AutoFitToWindow>]
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NoHeader]
[-PassThru]
[-Style <WordTableStyle>]
[-Transpose]
[-View <Normal|Transpose>]
[<CommonParameters>]
#
Parameter set: Context
Add-OfficeWordTable
[-CollectionSeparator <String>]
[[-Content] <ScriptBlock>]
[-DictionaryEntrySeparator <String>]
[-DictionaryKeyValueSeparator <String>]
-Document <WordDocument>
[-InputObject] <Object>
[-Layout <AutoFit|Fixed|AutoFitToContents|AutoFitToWindow>]
[-MaxCollectionItems <Int32>]
[-MaxNestingDepth <Int32>]
[-NoHeader]
[-PassThru]
[-Style <WordTableStyle>]
[-Transpose]
[-View <Normal|Transpose>]
[<CommonParameters>]
#
Parameter set: Document

Description

Transforms objects into an OfficeIMO table, applies styles/layout, and runs nested DSL customizations.

Examples

Create a styled grid.

Add-OfficeWordTable -InputObject $Data -Style 'GridTable1LightAccent1' { WordTableCondition -FilterScript { $_.Total -gt 1000 } }

Writes a grid table and highlights rows exceeding $1,000.

Add a table to a live document.

Add-OfficeWordTable -Document $document -InputObject $rows -Style GridTable4Accent1 -Layout AutoFitToWindow

Writes PowerShell objects as a table without requiring an active DSL scope.

Parameters

-CollectionSeparator String optional
Text used between items when a cell contains a collection.
-Content ScriptBlock optionalposition: 1
DSL content executed inside the table.
-DictionaryEntrySeparator String optional
Text used between entries when a cell contains a dictionary.
-DictionaryKeyValueSeparator String optional
Text used between a dictionary key and value.
-InputObject Object requiredposition: 0pipeline: True (ByValue)aliases: Data
Input data (array, list, DataTable, etc.).
-Layout OfficeWordTableLayout optional
Table layout behavior.
Possible values: AutoFit, Fixed, AutoFitToContents, AutoFitToWindow
-MaxCollectionItems Int32 optional
Maximum number of items allowed in one nested collection or dictionary cell. Defaults to 1,048,575; increase explicitly for trusted larger values.
-MaxNestingDepth Int32 optional
Maximum nesting depth allowed while normalizing one cell value. Defaults to 64; increase explicitly for trusted deeper values.
-NoHeader SwitchParameter optionalaliases: SkipHeader
Skip writing header row.
-PassThru SwitchParameter optional
Emit the created WordTable.
-Style WordTableStyle optional
Built-in table style.
Possible values: TableNormal, TableGrid, PlainTable1, PlainTable2, PlainTable3, PlainTable4, PlainTable5, GridTable1Light, GridTable1LightAccent1, GridTable1LightAccent2, GridTable1LightAccent3, GridTable1LightAccent4, GridTable1LightAccent5, GridTable1LightAccent6, GridTable2, GridTable2Accent1, GridTable2Accent2, GridTable2Accent3, GridTable2Accent4, GridTable2Accent5, GridTable2Accent6, GridTable3, GridTable3Accent1, GridTable3Accent2, GridTable3Accent3, GridTable3Accent4, GridTable3Accent5, GridTable3Accent6, GridTable4, GridTable4Accent1, GridTable4Accent2, GridTable4Accent3, GridTable4Accent4, GridTable4Accent5, GridTable4Accent6, GridTable5Dark, GridTable5DarkAccent1, GridTable5DarkAccent2, GridTable5DarkAccent3, GridTable5DarkAccent4, GridTable5DarkAccent5, GridTable5DarkAccent6, GridTable6Colorful, GridTable6ColorfulAccent1, GridTable6ColorfulAccent2, GridTable6ColorfulAccent3, GridTable6ColorfulAccent4, GridTable6ColorfulAccent5, GridTable6ColorfulAccent6, GridTable7Colorful, GridTable7ColorfulAccent1, GridTable7ColorfulAccent2, GridTable7ColorfulAccent3, GridTable7ColorfulAccent4, GridTable7ColorfulAccent5, GridTable7ColorfulAccent6, ListTable1Light, ListTable1LightAccent1, ListTable1LightAccent2, ListTable1LightAccent3, ListTable1LightAccent4, ListTable1LightAccent5, ListTable1LightAccent6, ListTable2, ListTable2Accent1, ListTable2Accent2, ListTable2Accent3, ListTable2Accent4, ListTable2Accent5, ListTable2Accent6, ListTable3, ListTable3Accent1, ListTable3Accent2, ListTable3Accent3, ListTable3Accent4, ListTable3Accent5, ListTable3Accent6, ListTable4, ListTable4Accent1, ListTable4Accent2, ListTable4Accent3, ListTable4Accent4, ListTable4Accent5, ListTable4Accent6, ListTable5Dark, ListTable5DarkAccent1, ListTable5DarkAccent2, ListTable5DarkAccent3, ListTable5DarkAccent4, ListTable5DarkAccent5, ListTable5DarkAccent6, ListTable6Colorful, ListTable6ColorfulAccent1, ListTable6ColorfulAccent2, ListTable6ColorfulAccent3, ListTable6ColorfulAccent4, ListTable6ColorfulAccent5, ListTable6ColorfulAccent6, ListTable7Colorful, ListTable7ColorfulAccent1, ListTable7ColorfulAccent2, ListTable7ColorfulAccent3, ListTable7ColorfulAccent4, ListTable7ColorfulAccent5, ListTable7ColorfulAccent6
-Transpose SwitchParameter optional
Legacy switch that maps to Transpose.
-View OfficeTableView optional
Projection to apply before writing the table.
Possible values: Normal, Transpose
-Document WordDocument requiredsets: Document
Document that will receive the table outside a DSL context.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.