API Reference
Add-OfficeWordTableRow
Appends a row to an existing Word table.
Remarks
Adds a new row to a WordTable that was already created or found in an existing document. The command accepts scalar values, arrays, dictionaries, ordered dictionaries, and PowerShell objects. Values are expanded from left to right across cells; missing values become empty cells. This keeps existing-document editing simple without forcing callers back into the Word DSL.
Examples
Append values to the first table.
PS>
$doc = Get-OfficeWord -Path .\Report.docx
$doc | Get-OfficeWordTable | Select-Object -First 1 |
Add-OfficeWordTableRow -Values 'Service', 'Ready', 'Low'
Adds one table row and writes the supplied values into its cells.
Append an object-like row to a table found by marker text.
PS>
$doc = Get-OfficeWord -Path .\Report.docx
$table = Find-OfficeWordTable -Document $doc -Text 'Risk marker' | Select-Object -First 1
$table | Add-OfficeWordTableRow -Values ([ordered]@{
Item = 'Mitigation plan'
Owner = 'Service Desk'
State = 'Ready'
})
$doc | Close-OfficeWord -Save
Uses an ordered dictionary so values are written into predictable table columns.
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.
Syntax
Add-OfficeWordTableRow [-PassThru] -Table <WordTable> [-Values <Object>] [<CommonParameters>]#All Parameter SetsParameters
- PassThru SwitchParameter
- Emit the created row for additional OfficeIMO-level edits.
- Table WordTable
- Existing Word table to append to, usually from Get-OfficeWordTable or Find-OfficeWordTable.
- Values Object
- Values to write into the new row. Arrays, dictionaries, ordered dictionaries, and objects are expanded across cells.
Outputs
OfficeIMO.Word.WordTableRow