Method InsertChart
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
documentWordDocumentThe document that holds the position.
atDocumentPositionWhere to insert.
kindChartKindThe chart's kind.
dataChartDataThe categories and series.
widthEmuThe displayed width (Word's default: 5486400 EMU, 6 inches).
heightEmuThe displayed height (Word's default: 3200400 EMU, 3.5 inches).
optionsChartInsertOptionsThe 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.