Table of Contents

Method RenderChart

Namespace
DocWright.Spreadsheet.Rendering
Assembly
DocWright.Spreadsheet.Rendering.dll

RenderChart(XlsxChart, SpreadsheetImageOptions?)

Draws one chart on its own, as an image as large as the chart is on its sheet: the chart part drawn by the engine a document's charts are drawn by, with the workbook's theme.

public byte[] RenderChart(XlsxChart chart, SpreadsheetImageOptions? options = null)

Parameters

chart XlsxChart

The chart, from Charts.

options SpreadsheetImageOptions

The image's format and size; null for a PNG at 96 dots per inch.

Returns

byte[]

The encoded image.

Remarks

A chart sheet's chart is drawn at the size its drawing gives it, and a chart with no size at all at the size Excel gives a chart it inserts (360 by 216 points). The image's format, resolution and size are Image's; its Layout gives the diagnostics and the limits, and Pages is not read.

Exceptions

ArgumentNullException

chart is null.

InvalidOperationException

The chart was removed from its workbook.

UnsupportedFeatureException

The chart is of a type that is not drawn: radar, bubble, surface and stock charts, and the 2016 types (a waterfall, a treemap, a funnel and the others Excel writes as cx:chart). Bar, column, line, area, pie, doughnut and scatter charts are drawn.

InvalidDocumentException

The chart part or the theme part is malformed.

ResourceLimitExceededException

The image is more pixels than the limits allow.