Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

Add-OfficeWordChart

Namespace PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument OfficeIMO.Word.WordParagraph
Outputs
OfficeIMO.Word.WordChart

Adds a chart to a Word document.

Remarks

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

Examples

Authored help example

Add a pie chart from object data.

PS>


Add-OfficeWordChart -Type Pie -Data $rows -CategoryProperty Region -SeriesProperty Revenue -Title 'Revenue mix'
        

Creates a pie chart using Region labels and Revenue as the slice values.

Add a line chart to an open document.

PS>


Add-OfficeWordChart -Document $doc -Type Line -Data $rows -CategoryProperty Month -SeriesProperty Sales,Profit -Legend
        

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

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.

Syntax

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

Parameters

CategoryProperty String requiredposition: namedpipeline: False
Property name used for category labels.
Data Object[] requiredposition: namedpipeline: False
Source objects used to build chart data.
FitToPageWidth SwitchParameter optionalposition: namedpipeline: False
Scale the chart width to the page content width.
HeightPixels Int32 optionalposition: namedpipeline: False
Chart height in pixels.
Legend SwitchParameter optionalposition: namedpipeline: False
Add a legend to the chart.
LegendPosition String optionalposition: namedpipeline: Falsevalues: 5
Legend position when -Legend is used.
Possible values: Left, Right, Top, Bottom, TopRight
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the created chart.
SeriesColor String[] optionalposition: namedpipeline: False
Color values applied to the series in order.
SeriesProperty String[] requiredposition: namedpipeline: False
Property names used as numeric series.
Title String optionalposition: namedpipeline: False
Optional chart title.
Type WordChartType optionalposition: namedpipeline: Falsevalues: 4
Chart type to create.
Possible values: Pie, Bar, Line, Area
WidthFraction Double optionalposition: namedpipeline: False
Fraction of the page content width to use when -FitToPageWidth is specified.
WidthPixels Int32 optionalposition: namedpipeline: False
Chart width in pixels.
XAxisTitle String optionalposition: namedpipeline: False
Optional X axis title for non-pie charts.
YAxisTitle String optionalposition: namedpipeline: False
Optional Y axis title for non-pie charts.

Outputs

OfficeIMO.Word.WordChart

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

Parameters

CategoryProperty String requiredposition: namedpipeline: False
Property name used for category labels.
Data Object[] requiredposition: namedpipeline: False
Source objects used to build chart data.
Document WordDocument optionalposition: namedpipeline: True (ByValue)
Target document that will receive the chart.
FitToPageWidth SwitchParameter optionalposition: namedpipeline: False
Scale the chart width to the page content width.
HeightPixels Int32 optionalposition: namedpipeline: False
Chart height in pixels.
Legend SwitchParameter optionalposition: namedpipeline: False
Add a legend to the chart.
LegendPosition String optionalposition: namedpipeline: Falsevalues: 5
Legend position when -Legend is used.
Possible values: Left, Right, Top, Bottom, TopRight
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the created chart.
SeriesColor String[] optionalposition: namedpipeline: False
Color values applied to the series in order.
SeriesProperty String[] requiredposition: namedpipeline: False
Property names used as numeric series.
Title String optionalposition: namedpipeline: False
Optional chart title.
Type WordChartType optionalposition: namedpipeline: Falsevalues: 4
Chart type to create.
Possible values: Pie, Bar, Line, Area
WidthFraction Double optionalposition: namedpipeline: False
Fraction of the page content width to use when -FitToPageWidth is specified.
WidthPixels Int32 optionalposition: namedpipeline: False
Chart width in pixels.
XAxisTitle String optionalposition: namedpipeline: False
Optional X axis title for non-pie charts.
YAxisTitle String optionalposition: namedpipeline: False
Optional Y axis title for non-pie charts.

Outputs

OfficeIMO.Word.WordChart

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

Parameters

CategoryProperty String requiredposition: namedpipeline: False
Property name used for category labels.
Data Object[] requiredposition: namedpipeline: False
Source objects used to build chart data.
FitToPageWidth SwitchParameter optionalposition: namedpipeline: False
Scale the chart width to the page content width.
HeightPixels Int32 optionalposition: namedpipeline: False
Chart height in pixels.
Legend SwitchParameter optionalposition: namedpipeline: False
Add a legend to the chart.
LegendPosition String optionalposition: namedpipeline: Falsevalues: 5
Legend position when -Legend is used.
Possible values: Left, Right, Top, Bottom, TopRight
Paragraph WordParagraph optionalposition: namedpipeline: True (ByValue)
Target paragraph used as the chart anchor.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the created chart.
SeriesColor String[] optionalposition: namedpipeline: False
Color values applied to the series in order.
SeriesProperty String[] requiredposition: namedpipeline: False
Property names used as numeric series.
Title String optionalposition: namedpipeline: False
Optional chart title.
Type WordChartType optionalposition: namedpipeline: Falsevalues: 4
Chart type to create.
Possible values: Pie, Bar, Line, Area
WidthFraction Double optionalposition: namedpipeline: False
Fraction of the page content width to use when -FitToPageWidth is specified.
WidthPixels Int32 optionalposition: namedpipeline: False
Chart width in pixels.
XAxisTitle String optionalposition: namedpipeline: False
Optional X axis title for non-pie charts.
YAxisTitle String optionalposition: namedpipeline: False
Optional Y axis title for non-pie charts.

Outputs

OfficeIMO.Word.WordChart