Class ExcelDrawing
Base class for drawings. Drawings are Charts, Shapes and Pictures.
Inheritance
Implements
Inherited Members
Namespace: OfficeOpenXml.Drawing
Assembly: EPPlus.dll
Syntax
public class ExcelDrawing : XmlHelper, IDisposable, IPictureContainer
Fields
_doNotAdjust
Declaration
protected bool _doNotAdjust
Field Value
Type | Description |
---|---|
System.Boolean |
EMU_PER_CM
Declaration
public const int EMU_PER_CM = 360000
Field Value
Type | Description |
---|---|
System.Int32 |
EMU_PER_PIXEL
Ratio between EMU and Pixels
Declaration
public const int EMU_PER_PIXEL = 9525
Field Value
Type | Description |
---|---|
System.Int32 |
EMU_PER_POINT
Ratio between EMU and Points
Declaration
public const int EMU_PER_POINT = 12700
Field Value
Type | Description |
---|---|
System.Int32 |
EMU_PER_US_INCH
Declaration
public const int EMU_PER_US_INCH = 914400
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
As
Provides access to type conversion for all top-level drawing classes.
Declaration
public ExcelDrawingAsType As { get; }
Property Value
Type | Description |
---|---|
ExcelDrawingAsType |
CellAnchor
How the drawing is anchored to the cells. This effect how the drawing will be resize ChangeCellAnchor(eEditAs, Int32, Int32, Int32, Int32)
Declaration
public eEditAs CellAnchor { get; }
Property Value
Type | Description |
---|---|
eEditAs |
Description
A description of the drawing object
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DrawingType
The type of drawing
Declaration
public virtual eDrawingType DrawingType { get; }
Property Value
Type | Description |
---|---|
eDrawingType |
EditAs
How Excel resize drawings when the column width is changed within Excel.
Declaration
public eEditAs EditAs { get; set; }
Property Value
Type | Description |
---|---|
eEditAs |
From
Top Left position, if the shape is of the one- or two- cell anchor type Otherwise this propery is set to null
Declaration
public ExcelPosition From { get; }
Property Value
Type | Description |
---|---|
ExcelPosition |
Hyperlink
Hyperlink
Declaration
public Uri Hyperlink { get; set; }
Property Value
Type | Description |
---|---|
System.Uri |
Locked
Lock drawing
Declaration
public bool Locked { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
The name of the drawing object
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Position
Top Left position, if the shape is of the absolute anchor type
Declaration
public ExcelDrawingCoordinate Position { get; }
Property Value
Type | Description |
---|---|
ExcelDrawingCoordinate |
Print drawing with sheet
Declaration
public bool Print { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Size
The extent of the shape, if the shape is of the one- or absolute- anchor type. Otherwise this propery is set to null
Declaration
public ExcelDrawingSize Size { get; }
Property Value
Type | Description |
---|---|
ExcelDrawingSize |
To
Bottom right position
Declaration
public ExcelPosition To { get; }
Property Value
Type | Description |
---|---|
ExcelPosition |
Methods
AdjustPositionAndSize()
Will adjust the position and size of the drawing according to changes in font of rows and to the Normal style. This method will be called before save, so use it only if you need the coordinates of the drawing.
Declaration
public void AdjustPositionAndSize()
BringToFront()
Brings the drawing to the front of any overlapping drawings.
Declaration
public void BringToFront()
ChangeCellAnchor(eEditAs)
This will change the cell anchor type without modifiying the position and size.
Declaration
public void ChangeCellAnchor(eEditAs type)
Parameters
Type | Name | Description |
---|---|---|
eEditAs | type | The cell anchor type to change to |
ChangeCellAnchor(eEditAs, Int32, Int32, Int32, Int32)
This will change the cell anchor type, move and resize the drawing.
Declaration
public void ChangeCellAnchor(eEditAs type, int PixelTop, int PixelLeft, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
eEditAs | type | The cell anchor type to change to |
System.Int32 | PixelTop | The topmost pixel |
System.Int32 | PixelLeft | The leftmost pixel |
System.Int32 | width | The width in pixels |
System.Int32 | height | The height in pixels |
Dispose()
Dispose the object
Declaration
public virtual void Dispose()
SendToBack()
Sends the drawing to the back of any overlapping drawings.
Declaration
public void SendToBack()
SetPosition(Int32, Int32)
Set the top left corner of a drawing. Note that resizing columns / rows after using this function will effect the position of the drawing
Declaration
public void SetPosition(int PixelTop, int PixelLeft)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PixelTop | Top pixel |
System.Int32 | PixelLeft | Left pixel |
SetPosition(Int32, Int32, Int32, Int32)
Set the top left corner of a drawing. Note that resizing columns / rows after using this function will effect the position of the drawing
Declaration
public void SetPosition(int Row, int RowOffsetPixels, int Column, int ColumnOffsetPixels)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Row | Start row - 0-based index. |
System.Int32 | RowOffsetPixels | Offset in pixels |
System.Int32 | Column | Start Column - 0-based index. |
System.Int32 | ColumnOffsetPixels | Offset in pixels |
SetSize(Int32)
Set size in Percent. Note that resizing columns / rows after using this function will effect the size of the drawing
Declaration
public virtual void SetSize(int Percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Percent |
SetSize(Int32, Int32)
Set size in pixels Note that resizing columns / rows after using this function will effect the size of the drawing
Declaration
public void SetSize(int PixelWidth, int PixelHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PixelWidth | Width in pixels |
System.Int32 | PixelHeight | Height in pixels |