OfficeIMO

API Reference

Class

WordChart

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Provides functionality for creating and manipulating charts within a WordDocument.

Inheritance

Constructors

WordChart 2 overloads
public WordChart(WordDocument document, WordParagraph paragraph, Drawing drawing) #

Initializes a WordChart instance from an existing drawing.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
Parent document that owns the chart.
paragraph OfficeIMO.Word.WordParagraph requiredposition: 1
Paragraph containing the chart.
drawing DocumentFormat.OpenXml.Wordprocessing.Drawing requiredposition: 2
Existing drawing element with chart data.
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 AddArea<T>(String name, Int32[] values, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
public Void AddArea3D<T>(String name, List<T> values, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
AddArea3D``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

Adds a 3D area chart series.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String required
Series name.
values System.Collections.Generic.List{``0} required
Series data values.
color SixLabors.ImageSharp.Color required
Series color.
AddArea``1 2 overloads
AddArea``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

Adds an area chart series using the provided values.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String required
Series name.
values System.Collections.Generic.List{``0} required
Values for the series.
color SixLabors.ImageSharp.Color required
Fill color for the series.
AddArea``1(System.String name, System.Int32[] values, SixLabors.ImageSharp.Color color) #

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

Type Parameters

T
Unused generic parameter.

Parameters

name System.String required
Series name.
values System.Int32[] required
Data values.
color SixLabors.ImageSharp.Color required
Fill color for the series.
AddBar 2 overloads
public Void AddBar(String name, Int32[] values, Color 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.

Type Parameters

T

Parameters

name System.String requiredposition: 0
values System.Int32 requiredposition: 1
color SixLabors.ImageSharp.Color requiredposition: 2
AddBar(System.String name, System.Int32[] values, SixLabors.ImageSharp.Color color) #

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

Parameters

name System.String required
values System.Int32[] required
color SixLabors.ImageSharp.Color required
public Void AddBar3D<T>(String name, List<T> values, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
AddBar3D``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

Adds a 3D bar chart series.

Type Parameters

T
Numeric type of the data values.

Parameters

name System.String required
Series name.
values System.Collections.Generic.List{``0} required
Series data values.
color SixLabors.ImageSharp.Color required
Color of the bars.
AddBar``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

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.

Parameters

name System.String required
values System.Collections.Generic.List{``0} required
color SixLabors.ImageSharp.Color required
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, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values Int32[] requiredposition: 1
color Color requiredposition: 2
AddChartLine``1(System.String name, System.Int32[] values, SixLabors.ImageSharp.Color color) #

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

Type Parameters

T
Unused generic parameter.

Parameters

name System.String required
Series name.
values System.Int32[] required
Values for the series.
color SixLabors.ImageSharp.Color required
Line color.
public Void AddLegend(LegendPositionValues legendPosition) #
Returns: Void

Adds a legend to the chart at the specified position.

Parameters

legendPosition DocumentFormat.OpenXml.Drawing.Charts.LegendPositionValues requiredposition: 0
Desired legend position.
public Void AddLine<T>(String name, List<T> values, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
public Void AddLine3D<T>(String name, List<T> values, Color color) #
Returns: Void

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
AddLine3D``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

Adds a 3D line chart series to the chart.

Type Parameters

T
The type of data values

Parameters

name System.String required
The name of the series
values System.Collections.Generic.List{``0} required
The data values for the series
color SixLabors.ImageSharp.Color required
The color of the series
AddLine``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

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.

Parameters

name System.String required
values System.Collections.Generic.List{``0} required
color SixLabors.ImageSharp.Color required
public WordChart AddPie<T>(String category, T value) #
Returns: WordChart

Type Parameters

T

Parameters

category String requiredposition: 0
value T requiredposition: 1
public WordChart AddPie3D<T>(String category, T value) #
Returns: WordChart

Type Parameters

T

Parameters

category String requiredposition: 0
value T requiredposition: 1
AddPie3D``1(System.String category, ``0 value) #

Adds a single value to a 3D pie chart.

Type Parameters

T
Numeric type representing the value.

Parameters

category System.String required
Category label.
value ``0 required
Data value for the slice.

Returns

The current WordChart instance.

AddPie``1(System.String category, ``0 value) #

Adds a single value to a pie chart.

Type Parameters

T
Numeric type representing the value.

Parameters

category System.String required
Category label.
value ``0 required
Data value for the slice.

Returns

The current WordChart instance.

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

Type Parameters

T

Parameters

name String requiredposition: 0
values List<T> requiredposition: 1
color Color requiredposition: 2
AddRadar``1(System.String name, System.Collections.Generic.List{``0} values, SixLabors.ImageSharp.Color color) #

Adds a radar chart series.

Type Parameters

T
Numeric type of the values.

Parameters

name System.String required
Series name.
values System.Collections.Generic.List{``0} required
Values for the series.
color SixLabors.ImageSharp.Color required
Color of the series.
public Void AddScatter(String name, List<Double> xValues, List<Double> yValues, Color 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 SixLabors.ImageSharp.Color requiredposition: 3
Color of the series.
AddSingleCategory(System.String category) #

Adds single category to charts

Parameters

category System.String required
The category.
AddSingleValue``1(``0 data) #

Adds the single value to charts

Type Parameters

T

Parameters

data ``0 required
The data.
public WordChart ApplyPalette(WordChartPalette palette, Boolean semanticOutcomes = true, Boolean applyToPies = true, Boolean applyToSeries = true, Dictionary<String, Color> 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,SixLabors.ImageSharp.Color} = null optionalposition: 4
public WordChart SetAxisTitleFormat(String fontName, Int32 fontSize, Color 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 SixLabors.ImageSharp.Color requiredposition: 2
Text color.

Returns

The current WordChart instance.

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

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

Parameters

index System.UInt32 requiredposition: 0
color SixLabors.ImageSharp.Color requiredposition: 1
public WordChart SetSeriesColor(UInt32 index, Color 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 SixLabors.ImageSharp.Color 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.

UpdateTitle() #

Update the title of the chart

Properties

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

Gets or sets the bar grouping mode for bar charts.

public Nullable<BarDirectionValues> 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.

PrivateTitle #

Holds the title of the chart until we can add it to the chart Note: the title can't really be added to a chart before we know what type of chart it is Since we don't know what type of chart it is until we add the first Pie, Bar, Line or Area we need to wait until then to add the title This is why we have a separate property for the title, but the method to add the title is in the WordChart class

public String Title { get; set; } #

Get or set the title of the chart

Fields

_currentIndexValues #

The current index for values

_currentIndexCategory #

The current index for categories