Table of Contents

Method InsertChart

Namespace
DocWright.Word.Editing
Assembly
DocWright.Word.dll

InsertChart(WordDocument, DocumentPosition, ChartKind, ChartData, Emu, Emu, ChartInsertOptions?)

Inserts an inline chart at a position, splitting a text run there: a chart part with the values in its caches, and, when Workbook is given, the workbook embedded as its data.

public static DocumentEdit InsertChart(this WordDocument document, DocumentPosition at, ChartKind kind, ChartData data, Emu width, Emu height, ChartInsertOptions? options = null)

Parameters

document WordDocument

The document that holds the position.

at DocumentPosition

Where to insert.

kind ChartKind

The chart's kind.

data ChartData

The categories and series.

width Emu

The displayed width (Word's default: 5486400 EMU, 6 inches).

height Emu

The displayed height (Word's default: 3200400 EMU, 3.5 inches).

options ChartInsertOptions

The grouping, direction, title, legend, workbook and name; null for Word's defaults.

Returns

DocumentEdit

The edit; After is just past the chart.

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

The position is not in document, the data has no series, more than MaxSeries series or MaxPoints points, a value that is not finite, a series whose length is not the categories', or a size that is not positive.

InvalidOperationException

The position is inside content a reader synthesized or a shape's text box.