API Reference
Cmdlet
Set-OfficeWordTableCell
Updates OfficeIMO Word table-cell content, layout, and merge settings.
Remarks
Updates OfficeIMO Word table-cell content, layout, and merge settings.
Examples
Replace text in a cell after finding a table.
PS>
$doc = Get-OfficeWord -Path .\Handover.docx
$table = Find-OfficeWordTable -Document $doc -Text 'Risk marker' | Select-Object -First 1
$table |
Get-OfficeWordTableCell -Row 2 -Column 2 |
Set-OfficeWordTableCell -Text 'Investigating' -ShadingFillColor '#fff2cc' -ShadingPattern Clear
$doc | Close-OfficeWord -Save
Finds an existing table by text, replaces a target cell value, applies shading, and saves the document.
Highlight a status column in the first report table.
PS>
$doc = Get-OfficeWord -Path .\Report.docx
$table = $doc | Get-OfficeWordTable | Select-Object -First 1
$table |
Get-OfficeWordTableCell -Column 2 |
Set-OfficeWordTableCell -ShadingFillColor '#fff1f0' -ShadingPattern Clear -Width 2400 -WidthType Dxa
$doc | Save-OfficeWord -Path .\Report-StatusCells.docx
Reads cells from an OfficeIMO table object, applies cell shading and width, and saves the updated document.
Merge a heading row across columns.
PS>
$doc = Get-OfficeWord -Path .\Report.docx
$table = $doc | Get-OfficeWordTable | Select-Object -First 1
$table |
Get-OfficeWordTableCell -Row 0 -Column 0 |
Set-OfficeWordTableCell -MergeRight 2 -CopyParagraphs
$doc | Save-OfficeWord -Path .\Report-MergedHeader.docx
Uses the OfficeIMO merge operation exposed by the thin table-cell wrapper.
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
Set-OfficeWordTableCell -Cell <WordTableCell> [-CopyParagraphs] [-FitText <Nullable`1>] [-MergeDown <Nullable`1>] [-MergeRight <Nullable`1>] [-PassThru] [-ShadingFillColor <String>] [-ShadingPattern <Nil>] [-SplitHorizontal <Nullable`1>] [-SplitVertical <Nullable`1>] [-Text <String>] [-TextDirection <Nullable`1>] [-Width <Nullable`1>] [-WidthType <Nil|Pct|Dxa|Auto>] [-WrapText <Nullable`1>] [<CommonParameters>]#Parameter set:
All Parameter SetsParameters
- Cell WordTableCell
- Table cell to update.
- CopyParagraphs SwitchParameter
- Copy paragraphs while merging cells.
- FitText Nullable`1
- Whether text should fit within the cell.
- MergeDown Nullable`1
- Number of cells to merge downward.
- MergeRight Nullable`1
- Number of cells to merge to the right.
- PassThru SwitchParameter
- Emit the updated table cell.
- ShadingFillColor String
- Cell shading fill color as #RRGGBB.
- ShadingPattern String
- Cell shading pattern.
- Possible values:
Nil,Clear,Solid,HorizontalStripe,VerticalStripe,ReverseDiagonalStripe,DiagonalStripe,HorizontalCross,DiagonalCross,ThinHorizontalStripe,ThinVerticalStripe,ThinReverseDiagonalStripe,ThinDiagonalStripe,ThinHorizontalCross,ThinDiagonalCross,Percent5,Percent10,Percent12,Percent15,Percent20,Percent25,Percent30,Percent35,Percent37,Percent40,Percent45,Percent50,Percent55,Percent60,Percent62,Percent65,Percent70,Percent75,Percent80,Percent85,Percent87,Percent90,Percent95 - SplitHorizontal Nullable`1
- Number of columns to split the cell into.
- SplitVertical Nullable`1
- Number of rows to split the cell into.
- Text String
- Replace the visible cell text.
- TextDirection Nullable`1
- Cell text direction.
- Width Nullable`1
- Cell width value.
- WidthType String
- Cell width unit type.
- Possible values:
Nil,Pct,Dxa,Auto - WrapText Nullable`1
- Whether text wraps in the cell.
Outputs
OfficeIMO.Word.WordTableCell