API Reference

Class

WordChart

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Provides functionality for creating and manipulating charts within a WordDocument.

Inheritance

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Constructors

public WordChart(WordDocument document, WordParagraph paragraph, String title = "", Boolean roundedCorners = false, Int32 width = 600, Int32 height = 600) #

Creates a new chart and inserts it into the specified paragraph.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
Parent document that will contain the chart.
paragraph OfficeIMO.Word.WordParagraph requiredposition: 1
Paragraph where the chart will be placed.
title System.String = "" optionalposition: 2
Optional chart title.
roundedCorners System.Boolean = false optionalposition: 3
Specifies whether the chart frame should have rounded corners.
width System.Int32 = 600 optionalposition: 4
Initial chart width in pixels.
height System.Int32 = 600 optionalposition: 5
Initial chart height in pixels.

Methods

public Void AddArea3D<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds a 3D area chart series.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String requiredposition: 0
Series name.
values System.Collections.Generic.List{``0} requiredposition: 1
Series data values.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Series color.
AddArea``1 2 overloads
public Void AddArea<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds an area chart series using the provided values.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String requiredposition: 0
Series name.
values System.Collections.Generic.List{``0} requiredposition: 1
Values for the series.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Fill color for the series.
public Void AddArea<T>(String name, Int32[] values, OfficeColor color) #
Returns: Void

Adds an area chart series using an array of integer values.

Type Parameters

T
Unused generic parameter.

Parameters

name System.String requiredposition: 0
Series name.
values System.Int32[] requiredposition: 1
Data values.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Fill color for the series.
AddBar 2 overloads
public Void AddBar(String name, Int32 values, OfficeColor color) #
Returns: Void

Adds a bar series to the chart. When mixing bar and line series be sure to call String>) first so the categories are shared across both chart types.

Parameters

arg1 System.String requiredposition: 0
arg2 System.Int32 requiredposition: 1
arg3 OfficeIMO.Drawing.OfficeColor requiredposition: 2
public Void AddBar(String name, Int32[] values, OfficeColor color) #
Returns: Void

Adds a bar series from an array of values. For combo charts ensure String>) has been called first.

Parameters

arg1 System.String requiredposition: 0
arg2 System.Int32[] requiredposition: 1
arg3 OfficeIMO.Drawing.OfficeColor requiredposition: 2
public Void AddBar3D<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds a 3D bar chart series.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String requiredposition: 0
Series name.
values System.Collections.Generic.List{``0} requiredposition: 1
Series data values.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Color of the bars.
public Void AddBar<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds a bar series with multiple values. When used in a combo chart with line series the categories must be set via String>) before calling this method.

Type Parameters

T

Parameters

arg1 System.String requiredposition: 0
arg2 System.Collections.Generic.List{``0} requiredposition: 1
arg3 OfficeIMO.Drawing.OfficeColor requiredposition: 2
public Void AddCategories(List<String> categories) #
Returns: Void

Sets the category labels used by subsequent chart series.

Parameters

categories System.Collections.Generic.List{System.String} requiredposition: 0
List of category names.
public Void AddChartAxisX(List<String> categories) #
Returns: Void

Sets the category labels for the X axis. This should be called before adding bar or line series when creating a combo chart so that both chart types share the same axis.

Parameters

categories System.Collections.Generic.List{System.String} requiredposition: 0
public Void AddChartLine<T>(String name, Int32[] values, OfficeColor color) #
Returns: Void

Adds a line series to the chart from an array of integer values.

Type Parameters

T
Unused generic parameter.

Parameters

name System.String requiredposition: 0
Series name.
values System.Int32[] requiredposition: 1
Values for the series.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Line color.
public Void AddLegend(OfficeChartLegendPosition legendPosition) #
Returns: Void

Adds a legend to the chart at the specified position.

Parameters

legendPosition OfficeIMO.Drawing.OfficeChartLegendPosition requiredposition: 0
Desired legend position.
public Void AddLine3D<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds a 3D line chart series to the chart.

Type Parameters

T
The type of data values

Parameters

name System.String requiredposition: 0
The name of the series
values System.Collections.Generic.List{``0} requiredposition: 1
The data values for the series
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
The color of the series
public Void AddLine<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Add a line to a chart. Multiple lines can be added. You cannot mix lines with pie charts. Lines can be combined with bar series to create combo charts, but make sure to call String>) before adding either series.

Type Parameters

T

Parameters

name System.String requiredposition: 0
values System.Collections.Generic.List{``0} requiredposition: 1
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
public WordChart AddPie3D<T>(String category, T value) #
Returns: WordChart

Adds a single value to a 3D pie chart.

Type Parameters

T
Numeric type representing the value.

Parameters

category System.String requiredposition: 0
Category label.
value ``0 requiredposition: 1
Data value for the slice.

Returns

The current WordChart instance.

public WordChart AddPie<T>(String category, T value) #
Returns: WordChart

Adds a single value to a pie chart.

Type Parameters

T
Numeric type representing the value.

Parameters

category System.String requiredposition: 0
Category label.
value ``0 requiredposition: 1
Data value for the slice.

Returns

The current WordChart instance.

public Void AddRadar<T>(String name, List<T> values, OfficeColor color) #
Returns: Void

Adds a radar chart series.

Type Parameters

T
Numeric type of the values.

Parameters

name System.String requiredposition: 0
Series name.
values System.Collections.Generic.List{``0} requiredposition: 1
Values for the series.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Color of the series.
public Void AddScatter(String name, List<Double> xValues, List<Double> yValues, OfficeColor color) #
Returns: Void

Adds a scatter chart series with separate X and Y values.

Parameters

name System.String requiredposition: 0
Series name.
xValues System.Collections.Generic.List{System.Double} requiredposition: 1
Values plotted on the X axis.
yValues System.Collections.Generic.List{System.Double} requiredposition: 2
Values plotted on the Y axis.
color OfficeIMO.Drawing.OfficeColor requiredposition: 3
Color of the series.
public WordChart ApplyPalette(WordChartPalette palette, Boolean semanticOutcomes = true, Boolean applyToPies = true, Boolean applyToSeries = true, Dictionary<String, OfficeColor> overrides = null) #
Returns: WordChart

Applies a built-in palette across the chart. Optionally honors semantic outcome names (Passed/Failed/Skipped/Error). Use applyToPies/applyToSeries to target types.

Parameters

palette OfficeIMO.Word.WordChart.WordChartPalette requiredposition: 0
semanticOutcomes System.Boolean = true optionalposition: 1
applyToPies System.Boolean = true optionalposition: 2
applyToSeries System.Boolean = true optionalposition: 3
overrides System.Collections.Generic.Dictionary{System.String,OfficeIMO.Drawing.OfficeColor} = null optionalposition: 4
public WordChart SetAxisTitleFormat(String fontName, Int32 fontSize, OfficeColor color) #
Returns: WordChart

Defines font formatting for axis titles.

Parameters

fontName System.String requiredposition: 0
Font family name.
fontSize System.Int32 requiredposition: 1
Font size in points.
color OfficeIMO.Drawing.OfficeColor requiredposition: 2
Text color.

Returns

The current WordChart instance.

public WordChart SetPieSliceColor(UInt32 index, OfficeColor color) #
Returns: WordChart

Sets the color of a specific pie slice by zero-based index.

Parameters

index System.UInt32 requiredposition: 0
color OfficeIMO.Drawing.OfficeColor requiredposition: 1
public WordChart SetSeriesColor(UInt32 index, OfficeColor color) #
Returns: WordChart

Sets the color of a specific series by its zero-based index across supported chart types.

Parameters

index System.UInt32 requiredposition: 0
color OfficeIMO.Drawing.OfficeColor requiredposition: 1
public WordChart SetSize(Int32 widthPx, Nullable<Int32> heightPx = null) #
Returns: WordChart

Sets the chart frame size. Values are in pixels.

Parameters

widthPx System.Int32 requiredposition: 0
heightPx System.Nullable{System.Int32} = null optionalposition: 1
public WordChart SetTitle(String title) #
Returns: WordChart

Set the title of the chart

Parameters

title System.String requiredposition: 0
public WordChart SetWidthToPageContent(Double fraction = 1, Nullable<Int32> heightPx = null) #
Returns: WordChart

Sets chart width to the page content width (page width minus left/right margins). Optionally scales by fraction and adjusts height in pixels.

Parameters

fraction System.Double = 1 optionalposition: 0
heightPx System.Nullable{System.Int32} = null optionalposition: 1
public WordChart SetXAxisTitle(String title) #
Returns: WordChart

Sets the title displayed on the X axis.

Parameters

title System.String requiredposition: 0
Axis title text.

Returns

The current WordChart instance.

public WordChart SetYAxisTitle(String title) #
Returns: WordChart

Sets the title displayed on the Y axis.

Parameters

title System.String requiredposition: 0
Axis title text.

Returns

The current WordChart instance.

public Boolean TryGetLayoutSnapshot(out WordDrawingLayoutSnapshot snapshot) #
Returns: Boolean

Reads persisted inline or anchored package geometry for this chart.

Parameters

snapshot OfficeIMO.Word.WordDrawingLayoutSnapshot@ requiredposition: 0
The package-geometry snapshot when the chart has a supported drawing frame.

Returns

true when persisted layout evidence was available.

public Boolean TryGetSnapshot(out WordChartSnapshot snapshot) #
Returns: Boolean

Tries to create a dependency-free chart snapshot from cached Word chart data.

Parameters

snapshot OfficeIMO.Word.WordChartSnapshot@ requiredposition: 0
public Boolean TrySetCategories(IEnumerable<String> categories) #
Returns: Boolean

Replaces the cached categories on every category-based series with literal values. Existing worksheet references are detached so Word cannot silently restore stale linked cache values. Scatter charts do not have category-axis data and are not changed.

Parameters

categories System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
The literal category labels to persist.

Returns

true when at least one imported or code-created series was updated.

public Boolean TrySetSeriesName(UInt32 seriesIndex, String name) #
Returns: Boolean

Replaces the cached name of an existing series with a literal value.

Parameters

seriesIndex System.UInt32 requiredposition: 0
The persisted chart series index (c:idx).
name System.String requiredposition: 1
The new series name.

Returns

true when the indexed series has a mutable series-text element.

public Boolean TrySetSeriesValues(UInt32 seriesIndex, IEnumerable<Double> values) #
Returns: Boolean

Replaces one series' cached numeric values with literal values. Worksheet references for that value range are detached, while unrelated embedded-workbook parts are preserved.

Parameters

seriesIndex System.UInt32 requiredposition: 0
The persisted chart series index (c:idx).
values System.Collections.Generic.IEnumerable{System.Double} requiredposition: 1
The literal numeric values to persist.

Returns

true when the indexed series and its numeric value container were found.

Properties

public Nullable<WordChartBarGrouping> BarGrouping { get; set; } #

Gets or sets the bar grouping mode for bar charts.

public Nullable<WordChartBarDirection> BarDirection { get; set; } #

Gets or sets the bar direction (row or column) for bar charts.

public Boolean RoundedCorners { get; set; } #

Gets or sets whether the chart frame uses rounded corners.

public String Title { get; set; } #

Get or set the title of the chart