# Add-OfficeWordChart

Adds a chart to a Word document. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

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 

Aliases: WordChart

**Module**

`PSWriteOffice`

**Aliases**

`WordChart`

**Inputs**

`OfficeIMO.Word.WordDocument` `OfficeIMO.Word.WordParagraph`

**Outputs**

`OfficeIMO.Word.WordChart`

**Source**

[AddOfficeWordChartCommand.cs:61](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/AddOfficeWordChartCommand.cs#L61) 

Adds a chart to a Word document.

## Syntax

```
Add-OfficeWordChart
-CategoryProperty <String>
[-FitToPageWidth]
[-HeightPixels <Int32>]
-InputObject <Object[]>
[-Legend]
[-LegendPosition <Bottom|TopRight|Left|Right|Top>]
[-PassThru]
[-SeriesColor <String[]>]
-SeriesProperty <String[]>
[-Title <String>]
[-Type <Pie|Bar|Line|Area>]
[-WidthFraction <Double>]
[-WidthPixels <Int32>]
[-XAxisTitle <String>]
[-YAxisTitle <String>]
[<CommonParameters>]
```

[#](#method-add-officewordchart-string-switchparameter-int32-object-switchparameter-officechartlegendposition-switchparameter-string-string-string-wordcharttype-double-int32-string-string)

Parameter set: `Context`

```
Add-OfficeWordChart
-CategoryProperty <String>
[-Document <WordDocument>]
[-FitToPageWidth]
[-HeightPixels <Int32>]
-InputObject <Object[]>
[-Legend]
[-LegendPosition <Bottom|TopRight|Left|Right|Top>]
[-PassThru]
[-SeriesColor <String[]>]
-SeriesProperty <String[]>
[-Title <String>]
[-Type <Pie|Bar|Line|Area>]
[-WidthFraction <Double>]
[-WidthPixels <Int32>]
[-XAxisTitle <String>]
[-YAxisTitle <String>]
[<CommonParameters>]
```

[#](#method-add-officewordchart-string-worddocument-switchparameter-int32-object-switchparameter-officechartlegendposition-switchparameter-string-string-string-wordcharttype-double-int32-string-string)

Parameter set: `Document`

```
Add-OfficeWordChart
-CategoryProperty <String>
[-FitToPageWidth]
[-HeightPixels <Int32>]
-InputObject <Object[]>
[-Legend]
[-LegendPosition <Bottom|TopRight|Left|Right|Top>]
[-Paragraph <WordParagraph>]
[-PassThru]
[-SeriesColor <String[]>]
-SeriesProperty <String[]>
[-Title <String>]
[-Type <Pie|Bar|Line|Area>]
[-WidthFraction <Double>]
[-WidthPixels <Int32>]
[-XAxisTitle <String>]
[-YAxisTitle <String>]
[<CommonParameters>]
```

[#](#method-add-officewordchart-string-switchparameter-int32-object-switchparameter-officechartlegendposition-wordparagraph-switchparameter-string-string-string-wordcharttype-double-int32-string-string)

Parameter set: `Paragraph`

## Description

Creates a Word chart from object data using one category property and one or more numeric series properties.

## Examples

### Add pie and line charts to a report.

```powershell
$rows = @(
    [pscustomobject]@{ Region = 'North America'; Revenue = 125000; Profit = 42000 }
    [pscustomobject]@{ Region = 'EMEA'; Revenue = 98000; Profit = 31000 }
    [pscustomobject]@{ Region = 'APAC'; Revenue = 143000; Profit = 52000 }
)
New-OfficeWord -Path .\RegionalReport.docx {
    Add-OfficeWordParagraph -Text 'Regional revenue'
    Add-OfficeWordChart -Type Pie -InputObject $rows -CategoryProperty Region -SeriesProperty Revenue -Title 'Revenue mix' -FitToPageWidth -WidthFraction 0.75
    Add-OfficeWordChart -Type Bar -InputObject $rows -CategoryProperty Region -SeriesProperty Revenue, Profit -Legend -XAxisTitle 'Region' -YAxisTitle 'Amount'
}
```

Creates a report with a pie chart and a multi-series bar chart from PowerShell objects.

### Add a line chart to an open document.

```powershell
$trend = @(
    [pscustomobject]@{ Month = 'Jan'; Sales = 10; Profit = 4 }
    [pscustomobject]@{ Month = 'Feb'; Sales = 12; Profit = 5 }
    [pscustomobject]@{ Month = 'Mar'; Sales = 15; Profit = 7 }
)
$doc = New-OfficeWord -Path .\Trend.docx -NoSave
Add-OfficeWordChart -Document $doc -Type Line -InputObject $trend -CategoryProperty Month -SeriesProperty Sales, Profit -Legend -Title 'Quarter trend'
Save-OfficeWord -Document $doc
```

Creates a multi-series line chart on the document and shows a legend.

## Parameters

**-CategoryProperty String required**

Property name used for category labels.

**-FitToPageWidth SwitchParameter optional**

Scale the chart width to the page content width.

**-HeightPixels Int32 optional**

Chart height in pixels.

**-InputObject Object[] requiredaliases: Data**

Source objects used to build chart data.

**-Legend SwitchParameter optional**

Add a legend to the chart.

**-LegendPosition OfficeChartLegendPosition optional**

Legend position when -Legend is used.

Possible values: `Bottom`, `TopRight`, `Left`, `Right`, `Top`

**-PassThru SwitchParameter optional**

Emit the created chart.

**-SeriesColor String[] optional**

Color values applied to the series in order.

**-SeriesProperty String[] required**

Property names used as numeric series.

**-Title String optional**

Optional chart title.

**-Type WordChartType optional**

Chart type to create.

Possible values: `Pie`, `Bar`, `Line`, `Area`

**-WidthFraction Double optional**

Fraction of the page content width to use when -FitToPageWidth is specified.

**-WidthPixels Int32 optional**

Chart width in pixels.

**-XAxisTitle String optional**

Optional X axis title for non-pie charts.

**-YAxisTitle String optional**

Optional Y axis title for non-pie charts.

**-Document WordDocument optionalpipeline: True (ByValue)sets: Document**

Target document that will receive the chart.

**-Paragraph WordParagraph optionalpipeline: True (ByValue)sets: Paragraph**

Target paragraph used as the chart anchor.

## 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:10FAF69190A7A5C5C41946D7E7CC09FAC084A6C9ACC982E764FF6ADBDA9367CD -->
