Class ExcelDrawings
- Namespace
- OfficeOpenXml.Drawing
- Assembly
- EPPlus.dll
Collection for Drawing objects.
public class ExcelDrawings : IEnumerable<ExcelDrawing>, IEnumerable, IDisposable
- Inheritance
-
ExcelDrawings
- Implements
- Inherited Members
Properties
Count
Number of items in the collection
public int Count { get; }
Property Value
DrawingXml
A reference to the drawing xml document
public XmlDocument DrawingXml { get; }
Property Value
- XmlDocument
this[int]
Returns the drawing at the specified position.
public ExcelDrawing this[int PositionID] { get; }
Parameters
PositionID
intThe position of the drawing. 0-base
Property Value
this[string]
Returns the drawing matching the specified name
public ExcelDrawing this[string Name] { get; }
Parameters
Name
stringThe name of the worksheet
Property Value
Methods
AddAreaChart(string, eAreaChartType)
Add a new area chart to the worksheet.
public ExcelAreaChart AddAreaChart(string Name, eAreaChartType ChartType)
Parameters
Name
stringChartType
eAreaChartTypeType of linechart
Returns
- ExcelAreaChart
The chart
AddAreaChart(string, eAreaChartType, ExcelPivotTable)
Adds a new area chart to the worksheet.
public ExcelAreaChart AddAreaChart(string Name, eAreaChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eAreaChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelAreaChart
The chart
AddBarChart(string, eBarChartType)
Adds a new barchart to the worksheet.
public ExcelBarChart AddBarChart(string Name, eBarChartType ChartType)
Parameters
Name
stringChartType
eBarChartTypeType of linechart
Returns
- ExcelBarChart
The chart
AddBarChart(string, eBarChartType, ExcelPivotTable)
Adds a new column- or bar- chart to the worksheet.
public ExcelBarChart AddBarChart(string Name, eBarChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eBarChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelBarChart
The chart
AddBoxWhiskerChart(string)
Adds a new box & whisker chart to the worksheet.
public ExcelBoxWhiskerChart AddBoxWhiskerChart(string Name)
Parameters
Name
string
Returns
- ExcelBoxWhiskerChart
The chart
AddBubbleChart(string, eBubbleChartType)
Adds a new bubble chart to the worksheet.
public ExcelBubbleChart AddBubbleChart(string Name, eBubbleChartType ChartType)
Parameters
Name
stringChartType
eBubbleChartTypeType of chart
Returns
- ExcelBubbleChart
The chart
AddBubbleChart(string, eBubbleChartType, ExcelPivotTable)
Adds a new bubble chart to the worksheet.
public ExcelBubbleChart AddBubbleChart(string Name, eBubbleChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eBubbleChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelBubbleChart
The chart
AddButtonControl(string)
Adds a button form control to the worksheet
public ExcelControlButton AddButtonControl(string Name)
Parameters
Name
stringThe name of the button
Returns
- ExcelControlButton
The button form control
AddChart(string, eChartType)
Adds a new chart to the worksheet. Do not support Stock charts .
public ExcelChart AddChart(string Name, eChartType ChartType)
Parameters
Name
stringChartType
eChartTypeType of chart
Returns
- ExcelChart
The chart
AddChart(string, eChartType, ExcelPivotTable, eEditAs)
Adds a new chart to the worksheet. Stock charts cannot be added by this method. See AddStockChart(string, eStockChartType, ExcelRangeBase, bool)
public ExcelChart AddChart(string Name, eChartType ChartType, ExcelPivotTable PivotTableSource, eEditAs DrawingType = eEditAs.TwoCell)
Parameters
Name
stringChartType
eChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
DrawingType
eEditAsThe top element drawingtype. Default is OneCellAnchor for Pictures and TwoCellAnchor from Charts and Shapes
Returns
- ExcelChart
The chart
AddChartFromTemplate(FileInfo, string)
Adds a new chart using an crtx template
public ExcelChart AddChartFromTemplate(FileInfo crtxFile, string name)
Parameters
Returns
- ExcelChart
The new chart
AddChartFromTemplate(FileInfo, string, ExcelPivotTable)
Adds a new chart using an crtx template
public ExcelChart AddChartFromTemplate(FileInfo crtxFile, string name, ExcelPivotTable pivotTableSource)
Parameters
crtxFile
FileInfoThe crtx file
name
stringThe name of the chart
pivotTableSource
ExcelPivotTablePivot table source, if the chart is a pivottable
Returns
- ExcelChart
The new chart
AddChartFromTemplate(Stream, string)
Adds a new chart using an crtx template
public ExcelChart AddChartFromTemplate(Stream crtxStream, string name)
Parameters
Returns
- ExcelChart
The new chart
AddChartFromTemplate(Stream, string, ExcelPivotTable)
Adds a new chart using an crtx template
public ExcelChart AddChartFromTemplate(Stream crtxStream, string name, ExcelPivotTable pivotTableSource)
Parameters
crtxStream
StreamThe crtx file as a stream
name
stringThe name of the chart
pivotTableSource
ExcelPivotTablePivot table source, if the chart is a pivottable
Returns
- ExcelChart
The new chart
AddCheckBoxControl(string)
Adds a checkbox form control to the worksheet
public ExcelControlCheckBox AddCheckBoxControl(string Name)
Parameters
Name
stringThe name of the checkbox control
Returns
- ExcelControlCheckBox
The checkbox form control
AddControl(string, eControlType)
Adds a form control to the worksheet
public ExcelControl AddControl(string Name, eControlType ControlType)
Parameters
Name
stringThe name
ControlType
eControlTypeThe type of control
Returns
Exceptions
- InvalidOperationException
Chart sheets cannot have controls
- ArgumentException
Drawing names must be unique
AddDoughnutChart(string, eDoughnutChartType)
Adds a new doughnut chart to the worksheet.
public ExcelDoughnutChart AddDoughnutChart(string Name, eDoughnutChartType ChartType)
Parameters
Name
stringChartType
eDoughnutChartTypeType of chart
Returns
- ExcelDoughnutChart
The chart
AddDoughnutChart(string, eDoughnutChartType, ExcelPivotTable)
Adds a new doughnut chart to the worksheet.
public ExcelDoughnutChart AddDoughnutChart(string Name, eDoughnutChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eDoughnutChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelDoughnutChart
The chart
AddDropDownControl(string)
Adds a drop-down form control to the worksheet
public ExcelControlDropDown AddDropDownControl(string Name)
Parameters
Name
stringThe name of the drop-down control
Returns
- ExcelControlDropDown
The drop-down form control
AddExtendedChart(string, eChartExType)
Adds a new chart to the worksheet.
public ExcelChartEx AddExtendedChart(string Name, eChartExType ChartType)
Parameters
Name
stringChartType
eChartExTypeType of chart
Returns
- ExcelChartEx
The chart
AddExtendedChart(string, eChartExType, ExcelPivotTable)
Adds a new extended chart to the worksheet. Extended charts are
public ExcelChartEx AddExtendedChart(string Name, eChartExType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eChartExTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelChartEx
The chart
AddFunnelChart(string)
Adds a funnel chart to the worksheet.
public ExcelFunnelChart AddFunnelChart(string Name)
Parameters
Name
string
Returns
- ExcelFunnelChart
The chart
AddGroupBoxControl(string)
Adds a group box form control to the worksheet
public ExcelControlGroupBox AddGroupBoxControl(string Name)
Parameters
Name
stringThe name of the group box control
Returns
- ExcelControlGroupBox
The group box form control
AddHistogramChart(string, bool)
Adds a new Histogram or Pareto chart to the worksheet.
public ExcelHistogramChart AddHistogramChart(string Name, bool AddParetoLine = false)
Parameters
Name
stringAddParetoLine
boolIf true a pareto line is added to the chart. The ChartType will also be Pareto.
Returns
- ExcelHistogramChart
The chart
AddLabelControl(string)
Adds a label form control to the worksheet
public ExcelControlLabel AddLabelControl(string Name)
Parameters
Name
stringThe name of the label control
Returns
- ExcelControlLabel
The label form control
AddLineChart(string, eLineChartType)
Add a new linechart to the worksheet.
public ExcelLineChart AddLineChart(string Name, eLineChartType ChartType)
Parameters
Name
stringChartType
eLineChartTypeType of linechart
Returns
- ExcelLineChart
The chart
AddLineChart(string, eLineChartType, ExcelPivotTable)
Adds a new linechart to the worksheet.
public ExcelLineChart AddLineChart(string Name, eLineChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eLineChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelLineChart
The chart
AddListBoxControl(string)
Adds a list box form control to the worksheet
public ExcelControlListBox AddListBoxControl(string Name)
Parameters
Name
stringThe name of the list box control
Returns
- ExcelControlListBox
The list box form control
AddOfPieChart(string, eOfPieChartType)
Adds a new line chart to the worksheet.
public ExcelOfPieChart AddOfPieChart(string Name, eOfPieChartType ChartType)
Parameters
Name
stringChartType
eOfPieChartTypeType of chart
Returns
- ExcelOfPieChart
The chart
AddOfPieChart(string, eOfPieChartType, ExcelPivotTable)
Add a new pie of pie or bar of pie chart to the worksheet.
public ExcelOfPieChart AddOfPieChart(string Name, eOfPieChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eOfPieChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelOfPieChart
The chart
AddPicture(string, FileInfo)
Adds a picture to the worksheet
public ExcelPicture AddPicture(string Name, FileInfo ImageFile)
Parameters
Returns
- ExcelPicture
A picture object
AddPicture(string, FileInfo, Uri)
Adds a picture to the worksheet
public ExcelPicture AddPicture(string Name, FileInfo ImageFile, Uri Hyperlink)
Parameters
Returns
- ExcelPicture
A picture object
AddPicture(string, Stream)
Adds a picture to the worksheet using a stream. EPPlus will identify the type of image automatically.
public ExcelPicture AddPicture(string Name, Stream PictureStream)
Parameters
Returns
- ExcelPicture
A picture object
AddPicture(string, Stream, ePictureType?)
Adds a picture to the worksheet
[Obsolete("This overload is deprecated, please use AddPicture(string, Stream) instead.")]
public ExcelPicture AddPicture(string Name, Stream PictureStream, ePictureType? PictureType)
Parameters
Name
stringPictureStream
StreamAn stream image.
PictureType
ePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
Returns
- ExcelPicture
A picture object
AddPicture(string, Stream, ePictureType?, Uri)
Adds a picture to the worksheet
[Obsolete("This overload is deprecated, please use AddPicture(string, Stream, Uri) instead.")]
public ExcelPicture AddPicture(string Name, Stream pictureStream, ePictureType? pictureType, Uri Hyperlink)
Parameters
Name
stringpictureStream
StreamAn stream image.
pictureType
ePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
Hyperlink
UriPicture Hyperlink
Returns
- ExcelPicture
A picture object
AddPicture(string, Stream, Uri)
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
public ExcelPicture AddPicture(string Name, Stream PictureStream, Uri Hyperlink)
Parameters
Returns
- ExcelPicture
A picture object
AddPicture(string, string)
Adds a picture to the worksheet
public ExcelPicture AddPicture(string Name, string ImagePath)
Parameters
Returns
- ExcelPicture
A picture object
AddPicture(string, string, ExcelHyperLink)
Adds a picture to the worksheet
public ExcelPicture AddPicture(string Name, string ImagePath, ExcelHyperLink Hyperlink)
Parameters
Name
stringThe name of the drawing object
ImagePath
stringThe path to the image file
Hyperlink
ExcelHyperLinkPicture Hyperlink
Returns
- ExcelPicture
A picture object
AddPictureAsync(string, FileInfo)
Adds a picture to the worksheet
public Task<ExcelPicture> AddPictureAsync(string Name, FileInfo ImageFile)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, FileInfo, Uri)
Adds a picture to the worksheet
public Task<ExcelPicture> AddPictureAsync(string Name, FileInfo ImageFile, Uri Hyperlink)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, Stream)
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
public Task<ExcelPicture> AddPictureAsync(string Name, Stream PictureStream)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, Stream, ePictureType?)
Adds a picture to the worksheet
[Obsolete("This overload is deprecated, please use AddPictureAsync(string, Stream) instead.")]
public Task<ExcelPicture> AddPictureAsync(string Name, Stream PictureStream, ePictureType? PictureType)
Parameters
Name
stringPictureStream
StreamAn stream image.
PictureType
ePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, Stream, ePictureType?, Uri)
Adds a picture to the worksheet
[Obsolete("This overload is deprecated, please use AddPictureAsync(string, Stream, Uri) instead.")]
public Task<ExcelPicture> AddPictureAsync(string Name, Stream pictureStream, ePictureType? pictureType, Uri Hyperlink)
Parameters
Name
stringpictureStream
StreamAn stream image.
pictureType
ePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
Hyperlink
UriThe Picture Hyperlink
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, Stream, Uri)
Adds a picture to the worksheet from a stream. EPPlus will identify the type of image automatically.
public Task<ExcelPicture> AddPictureAsync(string Name, Stream PictureStream, Uri Hyperlink)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, string)
Adds a picture to the worksheet
public Task<ExcelPicture> AddPictureAsync(string Name, string ImagePath)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPictureAsync(string, string, Uri)
Adds a picture to the worksheet
public Task<ExcelPicture> AddPictureAsync(string Name, string ImagePath, Uri Hyperlink)
Parameters
Returns
- Task<ExcelPicture>
A picture object
AddPieChart(string, ePieChartType)
Adds a new pie chart to the worksheet.
public ExcelPieChart AddPieChart(string Name, ePieChartType ChartType)
Parameters
Name
stringChartType
ePieChartTypeType of chart
Returns
- ExcelPieChart
The chart
AddPieChart(string, ePieChartType, ExcelPivotTable)
Adds a new pie chart to the worksheet.
public ExcelPieChart AddPieChart(string Name, ePieChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
ePieChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelPieChart
The chart
AddRadarChart(string, eRadarChartType)
Adds a new radar chart to the worksheet.
public ExcelRadarChart AddRadarChart(string Name, eRadarChartType ChartType)
Parameters
Name
stringChartType
eRadarChartTypeType of chart
Returns
- ExcelRadarChart
The chart
AddRadarChart(string, eRadarChartType, ExcelPivotTable)
Adds a new radar chart to the worksheet.
public ExcelRadarChart AddRadarChart(string Name, eRadarChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eRadarChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelRadarChart
The chart
AddRadioButtonControl(string)
Adds a radio button form control to the worksheet
public ExcelControlRadioButton AddRadioButtonControl(string Name)
Parameters
Name
stringThe name of the radio button control
Returns
- ExcelControlRadioButton
The radio button form control
AddRegionMapChart(string)
Adds a region map chart to the worksheet. Note that EPPlus rely on the spreadsheet application to create the geocache data
public ExcelRegionMapChart AddRegionMapChart(string Name)
Parameters
Name
string
Returns
- ExcelRegionMapChart
The chart
AddScatterChart(string, eScatterChartType)
Adds a new scatter chart to the worksheet.
public ExcelScatterChart AddScatterChart(string Name, eScatterChartType ChartType)
Parameters
Name
stringChartType
eScatterChartTypeType of chart
Returns
- ExcelScatterChart
The chart
AddScatterChart(string, eScatterChartType, ExcelPivotTable)
Adds a new scatter chart to the worksheet.
public ExcelScatterChart AddScatterChart(string Name, eScatterChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eScatterChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelScatterChart
The chart
AddScrollBarControl(string)
Adds a scroll bar control to the worksheet
public ExcelControlScrollBar AddScrollBarControl(string Name)
Parameters
Name
stringThe name of the scroll bar control
Returns
- ExcelControlScrollBar
The scroll bar form control
AddShape(string, ExcelShape)
Adds a new shape to the worksheet
public ExcelShape AddShape(string Name, ExcelShape Source)
Parameters
Name
stringName
Source
ExcelShapeSource shape
Returns
- ExcelShape
The shape object
AddShape(string, eShapeStyle)
Adds a new shape to the worksheet
public ExcelShape AddShape(string Name, eShapeStyle Style)
Parameters
Name
stringName
Style
eShapeStyleShape style
Returns
- ExcelShape
The shape object
AddSpinButtonControl(string)
Adds a spin button control to the worksheet
public ExcelControlSpinButton AddSpinButtonControl(string Name)
Parameters
Name
stringThe name of the spin button control
Returns
- ExcelControlSpinButton
The spin button form control
AddStockChart(string, eStockChartType, ExcelRangeBase, bool)
Adds a new stock chart to the worksheet.
Requires a range with four, five or six columns or rows depending on the stock chart type.
The first column/row is the category series.
The following columns/rows in the range depend on the stock chart type (HLC, OHLC, VHLC, VOHLC).
You can control if the range should be read by column or by row via the readSeriesByColumn
parameter.
public ExcelStockChart AddStockChart(string Name, eStockChartType ChartType, ExcelRangeBase Range, bool readSeriesByColumn = true)
Parameters
Name
stringChartType
eStockChartTypeThe Stock chart type
Range
ExcelRangeBaseThe range containing all the series. Must match the stock chart type's expected ranges
readSeriesByColumn
boolIf true the series will be read by column (left to right), if false they will be read by row (top-down)
Returns
- ExcelStockChart
The chart
AddStockChart(string, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase, ExcelRangeBase)
Adds a new stock chart to the worksheet. The stock chart type will depend on if the parameters OpenSerie and/or VolumeSerie is supplied
public ExcelStockChart AddStockChart(string Name, ExcelRangeBase CategorySerie, ExcelRangeBase HighSerie, ExcelRangeBase LowSerie, ExcelRangeBase CloseSerie, ExcelRangeBase OpenSerie = null, ExcelRangeBase VolumeSerie = null)
Parameters
Name
stringCategorySerie
ExcelRangeBaseThe category serie. A serie containng dates
HighSerie
ExcelRangeBaseThe high price serie
LowSerie
ExcelRangeBaseThe low price serie
CloseSerie
ExcelRangeBaseThe close price serie containing
OpenSerie
ExcelRangeBaseThe opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
VolumeSerie
ExcelRangeBaseThe volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
Returns
- ExcelStockChart
The chart
AddStockChart(string, string, string, string, string, string, string)
Adds a new stock chart to the worksheet. The stock chart type will depend on if the parameters OpenSerie and/or VolumeSerie is supplied
public ExcelStockChart AddStockChart(string Name, string CategorySerie, string HighSerie, string LowSerie, string CloseSerie, string OpenSerie = null, string VolumeSerie = null)
Parameters
Name
stringCategorySerie
stringThe category serie. A serie containing dates
HighSerie
stringThe high price serie
LowSerie
stringThe low price serie
CloseSerie
stringThe close price serie containing
OpenSerie
stringThe opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
VolumeSerie
stringThe volume represented as a column chart. Supplying this serie will create a StockVHLC or StockVOHLC chart
Returns
- ExcelStockChart
The chart
AddSunburstChart(string)
Adds a new sunburst chart to the worksheet.
public ExcelSunburstChart AddSunburstChart(string Name)
Parameters
Name
string
Returns
- ExcelSunburstChart
The chart
AddSurfaceChart(string, eSurfaceChartType)
Adds a new surface chart to the worksheet.
public ExcelSurfaceChart AddSurfaceChart(string Name, eSurfaceChartType ChartType)
Parameters
Name
stringChartType
eSurfaceChartTypeType of chart
Returns
- ExcelSurfaceChart
The chart
AddSurfaceChart(string, eSurfaceChartType, ExcelPivotTable)
Adds a new surface chart to the worksheet.
public ExcelSurfaceChart AddSurfaceChart(string Name, eSurfaceChartType ChartType, ExcelPivotTable PivotTableSource)
Parameters
Name
stringChartType
eSurfaceChartTypeType of chart
PivotTableSource
ExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelSurfaceChart
The chart
AddTableSlicer(ExcelTableColumn)
Adds a slicer to a table column
public ExcelTableSlicer AddTableSlicer(ExcelTableColumn TableColumn)
Parameters
TableColumn
ExcelTableColumnThe table column
Returns
- ExcelTableSlicer
The slicer drawing
AddTreemapChart(string)
Adds a new treemap chart to the worksheet.
public ExcelTreemapChart AddTreemapChart(string Name)
Parameters
Name
string
Returns
- ExcelTreemapChart
The chart
AddWaterfallChart(string)
Adds a waterfall chart to the worksheet.
public ExcelWaterfallChart AddWaterfallChart(string Name)
Parameters
Name
string
Returns
- ExcelWaterfallChart
The chart
Clear()
Removes all drawings from the collection
public void Clear()
Dispose()
Disposes the object
public void Dispose()
Remove(ExcelDrawing)
Removes a drawing.
public void Remove(ExcelDrawing Drawing)
Parameters
Drawing
ExcelDrawingThe drawing
Remove(int)
Removes a drawing.
public void Remove(int Index)
Parameters
Index
intThe index of the drawing
Remove(string)
Removes a drawing.
public void Remove(string Name)
Parameters
Name
stringThe name of the drawing