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
PositionIDintThe position of the drawing. 0-base
Property Value
this[string]
Returns the drawing matching the specified name
public ExcelDrawing this[string Name] { get; }
Parameters
NamestringThe 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
NamestringChartTypeeAreaChartTypeType 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
NamestringChartTypeeAreaChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringChartTypeeBarChartTypeType 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
NamestringChartTypeeBarChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
Namestring
Returns
- ExcelBoxWhiskerChart
The chart
AddBubbleChart(string, eBubbleChartType)
Adds a new bubble chart to the worksheet.
public ExcelBubbleChart AddBubbleChart(string Name, eBubbleChartType ChartType)
Parameters
NamestringChartTypeeBubbleChartTypeType 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
NamestringChartTypeeBubbleChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringThe 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
NamestringChartTypeeChartTypeType 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
NamestringChartTypeeChartTypeType of chart
PivotTableSourceExcelPivotTableThe pivottable source for a pivotchart
DrawingTypeeEditAsThe 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
crtxFileFileInfoThe crtx file
namestringThe name of the chart
pivotTableSourceExcelPivotTablePivot 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
crtxStreamStreamThe crtx file as a stream
namestringThe name of the chart
pivotTableSourceExcelPivotTablePivot 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
NamestringThe 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
NamestringThe name
ControlTypeeControlTypeThe 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
NamestringChartTypeeDoughnutChartTypeType 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
NamestringChartTypeeDoughnutChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringThe 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
NamestringChartTypeeChartExTypeType 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
NamestringChartTypeeChartExTypeType of chart
PivotTableSourceExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelChartEx
The chart
AddFunnelChart(string)
Adds a funnel chart to the worksheet.
public ExcelFunnelChart AddFunnelChart(string Name)
Parameters
Namestring
Returns
- ExcelFunnelChart
The chart
AddGroupBoxControl(string)
Adds a group box form control to the worksheet
public ExcelControlGroupBox AddGroupBoxControl(string Name)
Parameters
NamestringThe 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
NamestringAddParetoLineboolIf 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
NamestringThe 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
NamestringChartTypeeLineChartTypeType 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
NamestringChartTypeeLineChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringThe 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
NamestringChartTypeeOfPieChartTypeType 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
NamestringChartTypeeOfPieChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringPictureStreamStreamAn stream image.
PictureTypeePictureType?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
NamestringpictureStreamStreamAn stream image.
pictureTypeePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
HyperlinkUriPicture 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
NamestringThe name of the drawing object
ImagePathstringThe path to the image file
HyperlinkExcelHyperLinkPicture 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
NamestringPictureStreamStreamAn stream image.
PictureTypeePictureType?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
NamestringpictureStreamStreamAn stream image.
pictureTypeePictureType?The type of image. A null value means that EPPlus will identify the type of image automatically.
HyperlinkUriThe 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
NamestringChartTypeePieChartTypeType 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
NamestringChartTypeePieChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringChartTypeeRadarChartTypeType 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
NamestringChartTypeeRadarChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringThe 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
Namestring
Returns
- ExcelRegionMapChart
The chart
AddScatterChart(string, eScatterChartType)
Adds a new scatter chart to the worksheet.
public ExcelScatterChart AddScatterChart(string Name, eScatterChartType ChartType)
Parameters
NamestringChartTypeeScatterChartTypeType 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
NamestringChartTypeeScatterChartTypeType of chart
PivotTableSourceExcelPivotTableThe 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
NamestringThe 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
NamestringName
SourceExcelShapeSource shape
Returns
- ExcelShape
The shape object
AddShape(string, eShapeStyle)
Adds a new shape to the worksheet
public ExcelShape AddShape(string Name, eShapeStyle Style)
Parameters
NamestringName
StyleeShapeStyleShape style
Returns
- ExcelShape
The shape object
AddSpinButtonControl(string)
Adds a spin button control to the worksheet
public ExcelControlSpinButton AddSpinButtonControl(string Name)
Parameters
NamestringThe 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
NamestringChartTypeeStockChartTypeThe Stock chart type
RangeExcelRangeBaseThe range containing all the series. Must match the stock chart type's expected ranges
readSeriesByColumnboolIf 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
NamestringCategorySerieExcelRangeBaseThe category serie. A serie containng dates
HighSerieExcelRangeBaseThe high price serie
LowSerieExcelRangeBaseThe low price serie
CloseSerieExcelRangeBaseThe close price serie containing
OpenSerieExcelRangeBaseThe opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
VolumeSerieExcelRangeBaseThe 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
NamestringCategorySeriestringThe category serie. A serie containing dates
HighSeriestringThe high price serie
LowSeriestringThe low price serie
CloseSeriestringThe close price serie containing
OpenSeriestringThe opening price serie. Supplying this serie will create a StockOHLC or StockVOHLC chart
VolumeSeriestringThe 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
Namestring
Returns
- ExcelSunburstChart
The chart
AddSurfaceChart(string, eSurfaceChartType)
Adds a new surface chart to the worksheet.
public ExcelSurfaceChart AddSurfaceChart(string Name, eSurfaceChartType ChartType)
Parameters
NamestringChartTypeeSurfaceChartTypeType 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
NamestringChartTypeeSurfaceChartTypeType of chart
PivotTableSourceExcelPivotTableThe pivottable source for a pivotchart
Returns
- ExcelSurfaceChart
The chart
AddTableSlicer(ExcelTableColumn)
Adds a slicer to a table column
public ExcelTableSlicer AddTableSlicer(ExcelTableColumn TableColumn)
Parameters
TableColumnExcelTableColumnThe table column
Returns
- ExcelTableSlicer
The slicer drawing
AddTreemapChart(string)
Adds a new treemap chart to the worksheet.
public ExcelTreemapChart AddTreemapChart(string Name)
Parameters
Namestring
Returns
- ExcelTreemapChart
The chart
AddWaterfallChart(string)
Adds a waterfall chart to the worksheet.
public ExcelWaterfallChart AddWaterfallChart(string Name)
Parameters
Namestring
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
DrawingExcelDrawingThe drawing
Remove(int)
Removes a drawing.
public void Remove(int Index)
Parameters
IndexintThe index of the drawing
Remove(string)
Removes a drawing.
public void Remove(string Name)
Parameters
NamestringThe name of the drawing