# Set-OfficeExcelChartLegend

Configures legend visibility and styling for an Excel chart.

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 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelChart`

**Outputs**

`OfficeIMO.Excel.ExcelChart`

**Source**

[SetOfficeExcelChartLegendCommand.cs:18](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelChartLegendCommand.cs#L18) 

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>]
```

[#](#method-set-officeexcelchartlegend-boolean-excelchart-string-string-double-switchparameter-boolean-boolean-switchparameter-officechartlegendposition)

Parameter set: `All Parameter Sets`

## Examples

### Move the legend to the right.

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

Evotec API Reference Copyright 2026 Evotec Services

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