Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Set-OfficeExcelTheme

Aliases: ExcelTheme
Module
PSWriteOffice
Aliases
ExcelTheme
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Management.Automation.PSObject

Sets or resets the workbook theme package part for an Excel workbook.

Syntax

Set-OfficeExcelTheme
[-Default]
[-Name <String>]
[-PassThru]
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
#
Parameter set: Context
Set-OfficeExcelTheme
[-Default]
[-Name <String>]
[-PassThru]
[-Path] <String>
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
#
Parameter set: Path
Set-OfficeExcelTheme
[-Default]
-Document <ExcelDocument>
[-Name <String>]
[-PassThru]
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
#
Parameter set: Document

Examples

Reset and rename the workbook theme.

$theme = Set-OfficeExcelTheme -Path .\Report.xlsx -Default -Name 'Contoso Workbook Theme' -PassThru
Get-OfficeExcelSummary -Path .\Report.xlsx |
    Select-Object Path, WorksheetCount

Writes the built-in OfficeIMO workbook theme and updates its theme name.

Parameters

-Default SwitchParameter optional
Reset the workbook to the built-in OfficeIMO theme.
-Name String optional
Optional workbook theme name to apply after writing the theme.
-PassThru SwitchParameter optional
Emit workbook theme metadata after applying the update.
-Xml String optional
Theme XML to write to the workbook theme part.
-XmlPath String optional
Path to a DrawingML theme XML file.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to update outside the DSL context.

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.