Class ExcelDrawing
- Namespace
- OfficeOpenXml.Drawing
- Assembly
- EPPlus.dll
Base class for drawings. Drawings are Charts, Shapes and Pictures.
public class ExcelDrawing : XmlHelper, IDisposable
- Inheritance
-
ExcelDrawing
- Implements
- Derived
- Inherited Members
Fields
EMU_PER_CM
The ratio between EMU and centimeters
public const int EMU_PER_CM = 360000
Field Value
EMU_PER_MM
The ratio between EMU and milimeters
public const int EMU_PER_MM = 3600000
Field Value
EMU_PER_PICA
The ratio between EMU and pica
public const int EMU_PER_PICA = 152400
Field Value
EMU_PER_PIXEL
The ratio between EMU and Pixels
public const int EMU_PER_PIXEL = 9525
Field Value
EMU_PER_POINT
The ratio between EMU and Points
public const int EMU_PER_POINT = 12700
Field Value
EMU_PER_US_INCH
The ratio between EMU and US Inches
public const int EMU_PER_US_INCH = 914400
Field Value
Properties
As
Provides access to type conversion for all top-level drawing classes.
public ExcelDrawingAsType As { get; }
Property Value
CellAnchor
How the drawing is anchored to the cells. This effect how the drawing will be resize ChangeCellAnchor(eEditAs, int, int, int, int)
public eEditAs CellAnchor { get; protected set; }
Property Value
Description
A description of the drawing object
public string Description { get; set; }
Property Value
DrawingType
The type of drawing
public virtual eDrawingType DrawingType { get; }
Property Value
EditAs
How Excel resize drawings when the column width is changed within Excel.
public eEditAs EditAs { get; set; }
Property Value
From
Top Left position, if the shape is of the one- or two- cell anchor type Otherwise this propery is set to null
public ExcelPosition From { get; }
Property Value
Hyperlink
Hyperlink
public Uri Hyperlink { get; set; }
Property Value
- Uri
Locked
Lock drawing
public virtual bool Locked { get; set; }
Property Value
Name
The name of the drawing object
public virtual string Name { get; set; }
Property Value
ParentGroup
If the drawing is grouped this property contains the Group drawing containing the group. Otherwise this property is null
public ExcelGroupShape ParentGroup { get; }
Property Value
Position
Top Left position, if the shape is of the absolute anchor type
public ExcelDrawingCoordinate Position { get; }
Property Value
Print drawing with sheet
public virtual bool Print { get; set; }
Property Value
Size
The extent of the shape, if the shape is of the one- or absolute- anchor type. Otherwise this propery is set to null
public ExcelDrawingSize Size { get; }
Property Value
To
Bottom right position
public ExcelPosition To { get; }
Property Value
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.
public void AdjustPositionAndSize()
BringToFront()
Brings the drawing to the front of any overlapping drawings.
public void BringToFront()
ChangeCellAnchor(eEditAs)
This will change the cell anchor type without modifiying the position and size.
public void ChangeCellAnchor(eEditAs type)
Parameters
type
eEditAsThe cell anchor type to change to
ChangeCellAnchor(eEditAs, int, int, int, int)
This will change the cell anchor type, move and resize the drawing.
public void ChangeCellAnchor(eEditAs type, int PixelTop, int PixelLeft, int width, int height)
Parameters
type
eEditAsThe cell anchor type to change to
PixelTop
intThe topmost pixel
PixelLeft
intThe leftmost pixel
width
intThe width in pixels
height
intThe height in pixels
Copy(ExcelWorksheet, int, int, int, int)
public void Copy(ExcelWorksheet worksheet, int row, int col, int rowOffset = -2147483648, int colOffset = -2147483648)
Parameters
worksheet
ExcelWorksheetrow
intcol
introwOffset
intcolOffset
int
Dispose()
Dispose the object
public virtual void Dispose()
Group(params ExcelDrawing[])
Group the drawing together with a list of other drawings. UnGroup(bool) ParentGroup
public ExcelGroupShape Group(params ExcelDrawing[] drawing)
Parameters
drawing
ExcelDrawing[]The drawings to group
Returns
- ExcelGroupShape
The group shape
SendToBack()
Sends the drawing to the back of any overlapping drawings.
public void SendToBack()
SetPosition(int, int)
Set the top left corner of a drawing. Note that resizing columns / rows after using this function will effect the position of the drawing
public void SetPosition(int PixelTop, int PixelLeft)
Parameters
SetPosition(int, int, int, int)
Set the top left corner of a drawing. Note that resizing columns / rows after using this function will effect the position of the drawing
public void SetPosition(int Row, int RowOffsetPixels, int Column, int ColumnOffsetPixels)
Parameters
Row
intStart row - 0-based index.
RowOffsetPixels
intOffset in pixels
Column
intStart Column - 0-based index.
ColumnOffsetPixels
intOffset in pixels
SetSize(int)
Set size in Percent. Note that resizing columns / rows after using this function will effect the size of the drawing
public virtual void SetSize(int Percent)
Parameters
Percent
int
SetSize(int, int)
Set size in pixels Note that resizing columns / rows after using this function will effect the size of the drawing
public void SetSize(int PixelWidth, int PixelHeight)
Parameters
UnGroup(bool)
Will ungroup this drawing or the entire group, if this drawing is grouped together with other drawings. If this drawings is not grouped an InvalidOperationException will be returned.
public void UnGroup(bool ungroupThisItemOnly = true)
Parameters
ungroupThisItemOnly
boolIf true this drawing will be removed from the group. If it is false, the whole group will be disbanded. If true only this drawing will be removed.