# Set-OfficeExcelTheme

Applies an OfficeTheme or theme XML to a workbook.

Cmdlet 

Aliases: ExcelTheme

**Module**

`PSWriteOffice`

**Aliases**

`ExcelTheme`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[SetOfficeExcelThemeCommand.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelThemeCommand.cs#L30) 

Applies an OfficeTheme or theme XML to a workbook.

## Syntax

```
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
-Name <String>
[-PassThru]
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-exceldocument-string-switchparameter)

Parameter set: `Name`

```
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
[-Theme] <OfficeThemeInput>
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-exceldocument-string-switchparameter-officethemeinput)

Parameter set: `Theme`

```
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
-Xml <String>
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-exceldocument-string-switchparameter-string)

Parameter set: `Xml`

```
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
-XmlPath <String>
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-exceldocument-string-switchparameter-string-2)

Parameter set: `XmlPath`

## Examples

### Apply a built-in theme

```powershell
Open-OfficeExcel -Path .\Reports\Q3-Sales.xlsx {
    ExcelTheme Minimal
}
```

Restyles the workbook's cell styles, table styles and charts with the Minimal theme.

### Apply the corporate theme from a template

```powershell
Open-OfficeExcel -Path .\Reports\Legacy-Report.xlsx {
    ExcelTheme .\Templates\Northwind.xltx
}
```

Takes the colours and fonts from the company template so an older workbook matches current branding.

## Parameters

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Caller-owned workbook; omission uses the enclosing Excel content block.

**-Name String required in Name**

Optional workbook theme name to apply after writing the theme.

**-PassThru SwitchParameter optional**

Emits the native result after the operation.

**-Theme OfficeThemeInput requiredposition: 0sets: Theme**

Built-in Office theme, native theme object or a document whose visual theme is read.

**-Xml String requiredsets: Xml**

Theme XML to write to the workbook theme part.

**-XmlPath String requiredsets: XmlPath**

Literal path to an XML definition.

## 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).

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