Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeExcelTheme

Aliases: ExcelTheme
Module
PSWriteOffice
Aliases
ExcelTheme
Inputs
OfficeIMO.Excel.ExcelDocument

Applies an OfficeTheme or theme XML to a workbook.

Syntax

Set-OfficeExcelTheme
[-Document <ExcelDocument>]
-Name <String>
[-PassThru]
[<CommonParameters>]
#
Parameter set: Name
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
[-Theme] <OfficeThemeInput>
[<CommonParameters>]
#
Parameter set: Theme
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
-Xml <String>
[<CommonParameters>]
#
Parameter set: Xml
Set-OfficeExcelTheme
[-Document <ExcelDocument>]
[-Name <String>]
[-PassThru]
-XmlPath <String>
[<CommonParameters>]
#
Parameter set: XmlPath

Examples

Apply a built-in theme

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

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.