# Set-OfficeWordTableCell

Updates OfficeIMO Word table-cell content, layout, and merge settings.

Project

PSWriteOffice

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

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: WordTableCellStyle

**Module**

`PSWriteOffice`

**Aliases**

`WordTableCellStyle`

**Inputs**

`OfficeIMO.Word.WordTableCell`

**Outputs**

`OfficeIMO.Word.WordTableCell`

**Source**

[SetOfficeWordTableCellCommand.cs:50](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/SetOfficeWordTableCellCommand.cs#L50) 

Updates OfficeIMO Word table-cell content, layout, and merge settings.

## Syntax

```
Set-OfficeWordTableCell
[-Cell] <WordTableCell>
[-CopyParagraphs]
[-FitText <Boolean>]
[-MarginBottomCentimeters <Double>]
[-MarginLeftCentimeters <Double>]
[-MarginRightCentimeters <Double>]
[-MarginTopCentimeters <Double>]
[-MergeDown <Int32>]
[-MergeRight <Int32>]
[-PassThru]
[-ShadingFillColor <String>]
[-ShadingPattern <WordShadingPattern>]
[-SplitHorizontal <Int32>]
[-SplitVertical <Int32>]
[-Text <String>]
[-TextDirection <WordTextDirection>]
[-Width <Int32>]
[-WidthType <Nil|Pct|Dxa|Auto>]
[-WrapText <Boolean>]
[<CommonParameters>]
```

[#](#member-64c75d9dbd6873bf7e18321e)

Parameter set: `All Parameter Sets`

## Examples

### Replace text in a cell after finding a table.

```powershell
$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.

```powershell
$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.

### Add readable padding to every cell in a report table.

```powershell
$table | Get-OfficeWordTableCell | Set-OfficeWordTableCell -MarginTopCentimeters 0.12 -MarginBottomCentimeters 0.12 -MarginLeftCentimeters 0.16 -MarginRightCentimeters 0.16
```

Sets independent cell margins in centimeters. Omitted margins retain their values; pass null to remove an explicit margin.

### Merge a heading row across columns.

```powershell
$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.

## Parameters

**-Cell WordTableCell requiredposition: 0pipeline: True (ByValue)**

Table cell to update.

**-CopyParagraphs SwitchParameter optional**

Copy paragraphs while merging cells.

**-FitText Boolean optional**

Whether text should fit within the cell.

**-MarginBottomCentimeters Double optional**

Bottom cell padding in centimeters. Pass null to remove the explicit margin.

**-MarginLeftCentimeters Double optional**

Left cell padding in centimeters. Pass null to remove the explicit margin.

**-MarginRightCentimeters Double optional**

Right cell padding in centimeters. Pass null to remove the explicit margin.

**-MarginTopCentimeters Double optional**

Top cell padding in centimeters. Pass null to remove the explicit margin.

**-MergeDown Int32 optional**

Number of cells to merge downward.

**-MergeRight Int32 optional**

Number of cells to merge to the right.

**-PassThru SwitchParameter optional**

Emit the updated table cell.

**-ShadingFillColor String optional**

Cell shading fill color. Named colors and hexadecimal values are accepted.

**-ShadingPattern WordShadingPattern optional**

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 Int32 optional**

Number of columns to split the cell into.

**-SplitVertical Int32 optional**

Number of rows to split the cell into.

**-Text String optional**

Replace the visible cell text.

**-TextDirection WordTextDirection optional**

Cell text direction.

Possible values: `LeftToRightTopToBottom`, `LeftToRightTopToBottom2010`, `TopToBottomRightToLeft`, `TopToBottomRightToLeft2010`, `BottomToTopLeftToRight`, `BottomToTopLeftToRight2010`, `LeftToRightTopToBottomRotated`, `LeftToRightTopToBottomRotated2010`, `TopToBottomRightToLeftRotated`, `TopToBottomRightToLeftRotated2010`, `TopToBottomLeftToRightRotated`, `TopToBottomLeftToRightRotated2010`

**-Width Int32 optional**

Cell width value.

**-WidthType WordTableWidthUnit optional**

Cell width unit type.

Possible values: `Nil`, `Pct`, `Dxa`, `Auto`

**-WrapText Boolean optional**

Whether text wraps in the cell.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:B296E5A4BEC14CA85D1263937F38670AA9B12A1D45FFC3CB9DECB68C1C264507 -->
