Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Set-OfficeExcelChartTrendline

Aliases: ExcelChartTrendline
Namespace PSWriteOffice
Aliases
ExcelChartTrendline
Inputs
OfficeIMO.Excel.ExcelChart
Outputs
OfficeIMO.Excel.ExcelChart

Adds or replaces an Excel chart series trendline.

Remarks

Adds or replaces an Excel chart series trendline.

Examples

Authored help example

Add a polynomial trendline.

PS>


$chart | Set-OfficeExcelChartTrendline -SeriesIndex 0 -Type Polynomial -Order 2 -DisplayEquation -DisplayRSquared
        

Adds a polynomial trendline to the first series.

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

Set-OfficeExcelChartTrendline [-Backward <Double>] -Chart <ExcelChart> [-DisplayEquation] [-DisplayRSquared] [-Forward <Double>] [-Intercept <Double>] [-LineColor <String>] [-LineWidthPoints <Double>] [-Order <Int32>] [-PassThru] [-Period <Int32>] -SeriesIndex <Int32> -Type <Exponential> [<CommonParameters>]
#
Parameter set: Index

Parameters

Backward Double optionalposition: namedpipeline: False
Backward forecast units.
Chart ExcelChart requiredposition: namedpipeline: True (ByValue)
Chart to update.
DisplayEquation SwitchParameter optionalposition: namedpipeline: False
Display the trendline equation.
DisplayRSquared SwitchParameter optionalposition: namedpipeline: False
Display the R-squared value.
Forward Double optionalposition: namedpipeline: False
Forward forecast units.
Intercept Double optionalposition: namedpipeline: False
Trendline intercept.
LineColor String optionalposition: namedpipeline: False
Trendline line color. Named colors and hexadecimal values are accepted.
LineWidthPoints Double optionalposition: namedpipeline: False
Trendline line width in points.
Order Int32 optionalposition: namedpipeline: False
Polynomial order.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.
Period Int32 optionalposition: namedpipeline: False
Moving-average period.
SeriesIndex Int32 requiredposition: namedpipeline: False
Zero-based series index.
Type OfficeChartTrendlineType requiredposition: namedpipeline: Falsevalues: 6
Trendline type.
Possible values: Exponential, Linear, Logarithmic, MovingAverage, Polynomial, Power

Outputs

OfficeIMO.Excel.ExcelChart

Set-OfficeExcelChartTrendline [-Backward <Double>] -Chart <ExcelChart> [-DisplayEquation] [-DisplayRSquared] [-Forward <Double>] [-IgnoreCase <Boolean>] [-Intercept <Double>] [-LineColor <String>] [-LineWidthPoints <Double>] [-Order <Int32>] [-PassThru] [-Period <Int32>] -SeriesName <String> -Type <Exponential> [<CommonParameters>]
#
Parameter set: Name

Parameters

Backward Double optionalposition: namedpipeline: False
Backward forecast units.
Chart ExcelChart requiredposition: namedpipeline: True (ByValue)
Chart to update.
DisplayEquation SwitchParameter optionalposition: namedpipeline: False
Display the trendline equation.
DisplayRSquared SwitchParameter optionalposition: namedpipeline: False
Display the R-squared value.
Forward Double optionalposition: namedpipeline: False
Forward forecast units.
IgnoreCase Boolean optionalposition: namedpipeline: False
Ignore case when matching series name.
Intercept Double optionalposition: namedpipeline: False
Trendline intercept.
LineColor String optionalposition: namedpipeline: False
Trendline line color. Named colors and hexadecimal values are accepted.
LineWidthPoints Double optionalposition: namedpipeline: False
Trendline line width in points.
Order Int32 optionalposition: namedpipeline: False
Polynomial order.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.
Period Int32 optionalposition: namedpipeline: False
Moving-average period.
SeriesName String requiredposition: namedpipeline: False
Series name.
Type OfficeChartTrendlineType requiredposition: namedpipeline: Falsevalues: 6
Trendline type.
Possible values: Exponential, Linear, Logarithmic, MovingAverage, Polynomial, Power

Outputs

OfficeIMO.Excel.ExcelChart