Class WorksheetShapeCollection
Represents a collection of shapes on a Worksheet.
Inherited Members
Namespace: DRIT.Spreadsheet.Drawing
Assembly: DRIT.Spreadsheet.dll
Syntax
public class WorksheetShapeCollection : ShapeCollection, IEnumerable<AbstractShape>, IEnumerable
Properties
Worksheet
Exposes the worksheet associated with WorksheetShapeCollection.
Declaration
public Worksheet Worksheet { get; }
Property Value
| Type | Description |
|---|---|
| Worksheet | The worksheet returned by the operation. |
Methods
AddConnector(ShapeType, int, string, string, PointDoubleUnit, SizeEmu)
Adds the supplied connector to the WorksheetShapeCollection.
Declaration
public ConnectorShape AddConnector(ShapeType shapeType, int id, string name, string label, PointDoubleUnit cellOffset, SizeEmu size)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType | |
| int | id | |
| string | name | |
| string | label | |
| PointDoubleUnit | cellOffset | |
| SizeEmu | size |
Returns
| Type | Description |
|---|---|
| ConnectorShape | The add connector returned by the operation. |
AddConnector(ShapeType, int, string, string, Position, Size)
Adds the supplied connector to the WorksheetShapeCollection.
Declaration
public ConnectorShape AddConnector(ShapeType shapeType, int id, string name, string label, Position cellOffset, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType | |
| int | id | |
| string | name | |
| string | label | |
| Position | cellOffset | |
| Size | size |
Returns
| Type | Description |
|---|---|
| ConnectorShape | The add connector returned by the operation. |
AddConnector(int, string, string, Position, Size)
Adds the supplied connector to the WorksheetShapeCollection.
Declaration
public ConnectorShape AddConnector(int id, string name, string label, Position cellOffsetPixel, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| string | name | |
| string | label | |
| Position | cellOffsetPixel | |
| Size | size |
Returns
| Type | Description |
|---|---|
| ConnectorShape | The add connector returned by the operation. |
AddConnector(string, Position, Size)
Adds the supplied connector to the WorksheetShapeCollection.
Declaration
public ConnectorShape AddConnector(string label, Position cellOffsetPixel, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | |
| Position | cellOffsetPixel | |
| Size | size |
Returns
| Type | Description |
|---|---|
| ConnectorShape | The add connector returned by the operation. |
AddGroup(string, Position, Size, string)
Adds a group anchored at the specified worksheet cell.
Declaration
public GroupShape AddGroup(string label, Position cellOffset, Size size, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | The top-left anchor cell label. |
| Position | cellOffset | The offset within the anchor cell. |
| Size | size | The group size. |
| string | name | The optional group name. |
Returns
| Type | Description |
|---|---|
| GroupShape | The newly added group. |
AddPicture(string, string)
Adds a picture from a file, anchored at the specified cell with the image's natural size. The image dimensions are read from the file and converted to EMU.
Declaration
public PictureShape AddPicture(string filePath, string anchorCellLabel)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | Path to the image file. |
| string | anchorCellLabel | The cell label (e.g. "B5") where the picture is anchored. |
Returns
| Type | Description |
|---|---|
| PictureShape |
AddPicture(string, string, Position, Size)
Adds the supplied picture to the WorksheetShapeCollection.
Declaration
public PictureShape AddPicture(string filePath, string anchoredCellLabel, Position cellOffsetPixel, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | |
| string | anchoredCellLabel | |
| Position | cellOffsetPixel | |
| Size | size |
Returns
| Type | Description |
|---|---|
| PictureShape | The add picture returned by the operation. |
AddShape(AbstractShape)
Adds the supplied shape to the WorksheetShapeCollection.
Declaration
public void AddShape(AbstractShape sheetShape)
Parameters
| Type | Name | Description |
|---|---|---|
| AbstractShape | sheetShape | The sheet shape used by the operation. |
AddShape(ShapeType, int, string, string, Position, Size)
Adds the supplied shape to the WorksheetShapeCollection.
Declaration
public Shape AddShape(ShapeType shapeType, int id, string name, string cellLabel, Position cellOffset, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType | |
| int | id | |
| string | name | |
| string | cellLabel | |
| Position | cellOffset | |
| Size | size |
Returns
| Type | Description |
|---|---|
| Shape | The add shape returned by the operation. |
AddShape(ShapeType, string, Position, Size)
Adds the supplied shape to the WorksheetShapeCollection.
Declaration
public Shape AddShape(ShapeType type, string label, Position cellOffsetPixel, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | type | |
| string | label | |
| Position | cellOffsetPixel | |
| Size | size |
Returns
| Type | Description |
|---|---|
| Shape | The add shape returned by the operation. |
AddShape(ShapeType, string, string)
Adds a shape that spans the cell range from fromCell
to toCell. The shape is positioned and sized
to cover the entire range.
Declaration
public Shape AddShape(ShapeType shapeType, string fromCell, string toCell)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType | The type of shape to add. |
| string | fromCell | The top-left cell label (e.g. "B5"). |
| string | toCell | The bottom-right cell label (e.g. "D10"). |
Returns
| Type | Description |
|---|---|
| Shape |
AddShape(int, string, string, Position, Size)
Adds the supplied shape to the WorksheetShapeCollection.
Declaration
public Shape AddShape(int id, string name, string cellLabel, Position cellOffset, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| string | name | |
| string | cellLabel | |
| Position | cellOffset | |
| Size | size |
Returns
| Type | Description |
|---|---|
| Shape | The add shape returned by the operation. |
AddTextBox(int, string, string, Position, Size)
Adds the supplied text box to the WorksheetShapeCollection.
Declaration
public TextBoxShape AddTextBox(int id, string name, string label, Position cellOffset, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| string | name | |
| string | label | |
| Position | cellOffset | |
| Size | size |
Returns
| Type | Description |
|---|---|
| TextBoxShape | The add text box returned by the operation. |
AddTextBox(string, Position, Size)
Adds the supplied text box to the WorksheetShapeCollection.
Declaration
public TextBoxShape AddTextBox(string label, Position cellOffsetPixel, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | |
| Position | cellOffsetPixel | |
| Size | size |
Returns
| Type | Description |
|---|---|
| TextBoxShape | The add text box returned by the operation. |
GetDiagram(string)
Retrieves the requested diagram from the WorksheetShapeCollection.
Declaration
public DiagramShape GetDiagram(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name used by the operation. |
Returns
| Type | Description |
|---|---|
| DiagramShape | The get diagram returned by the operation. |
GetFirstConnectorByCell(string)
Retrieves the requested first connector by cell from the WorksheetShapeCollection.
Declaration
public ConnectorShape GetFirstConnectorByCell(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | The label used by the operation. |
Returns
| Type | Description |
|---|---|
| ConnectorShape | The get first connector by cell returned by the operation. |
GetFirstShapeByCell(string)
Retrieves the requested first shape by cell from the WorksheetShapeCollection.
Declaration
public Shape GetFirstShapeByCell(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | The label used by the operation. |
Returns
| Type | Description |
|---|---|
| Shape | The get first shape by cell returned by the operation. |
GetShape(string)
Exposes the shape associated with WorksheetShapeCollection.
Declaration
public Shape GetShape(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name used by the operation. |
Returns
| Type | Description |
|---|---|
| Shape | The shape returned by the operation. |
OnRemove(AbstractShape)
Exposes the on remove associated with WorksheetShapeCollection.
Declaration
protected override void OnRemove(AbstractShape shape)
Parameters
| Type | Name | Description |
|---|---|---|
| AbstractShape | shape | The shape used by the operation. |