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-OfficeExcelChartLegend

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelChart
Outputs
OfficeIMO.Excel.ExcelChart

Configures legend visibility and styling for an Excel chart.

Syntax

Set-OfficeExcelChartLegend
[-Bold <Boolean>]
-Chart <ExcelChart>
[-Color <String>]
[-FontName <String>]
[-FontSizePoints <Double>]
[-Hide]
[-Italic <Boolean>]
[-Overlay <Boolean>]
[-PassThru]
[-Position <Bottom|TopRight|Left|Right|Top>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Examples

Move the legend to the right.

$chart | Set-OfficeExcelChartLegend -Position Right

Shows the legend on the right side of the chart and returns the chart for chaining.

Parameters

-Bold Boolean optional
Optional bold setting for legend text.
-Chart ExcelChart requiredpipeline: True (ByValue)
Chart to update.
-Color String optional
Optional legend text color. Named colors and hexadecimal values are accepted.
-FontName String optional
Optional legend font name.
-FontSizePoints Double optional
Optional legend font size in points.
-Hide SwitchParameter optional
Hide the legend instead of positioning it.
-Italic Boolean optional
Optional italic setting for legend text.
-Overlay Boolean optional
Overlay the legend on the chart area.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Position OfficeChartLegendPosition optional
Legend position.
Possible values: Bottom, TopRight, Left, Right, Top

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.