[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Drawing.IShapes.AddConnector

AddConnector Method

AddConnector(ConnectorType, double, double, double, double)

Creates a connector and returns the IShape object that represents the new connector.

The connector's starting and end points are specified in points relative to the upper-left corner of the document.

Declaration
IShape AddConnector(ConnectorType type, double beginX, double beginY, double endX, double endY)
Function AddConnector(type As ConnectorType, beginX As Double, beginY As Double, endX As Double, endY As Double) As IShape
Parameters
Type Name Description
ConnectorType type

The connector type to add.

double beginX

The horizontal position, in points, of the connector's starting point relative to the upper-left corner of the document.

double beginY

The vertical position, in points, of the connector's starting point relative to the upper-left corner of the document.

double endX

The horizontal position, in points, of the connector's end point relative to the upper-left corner of the document.

double endY

The vertical position, in points, of the connector's end point relative to the upper-left corner of the document.

Returns
Type Description
IShape

The IShape object that represents the new connector.

Examples
IShape shape1 = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 80, 50);
IShape shape2 = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, 180, 20, 80, 50);
IShape connector = worksheet.Shapes.AddConnector(ConnectorType.Straight, 100, 45, 180, 45);
connector.ConnectorFormat.BeginConnect(shape1, 3);
connector.ConnectorFormat.EndConnect(shape2, 1);

AddConnector(ConnectorType, IRange)

Creates a connector at the specified range on the current sheet.

The sheet of targetRange and the sheet of the shape being added must be the same sheet.

Declaration
IShape AddConnector(ConnectorType type, IRange targetRange)
Function AddConnector(type As ConnectorType, targetRange As IRange) As IShape
Parameters
Type Name Description
ConnectorType type

The connector type to add.

IRange targetRange

The target range on the current sheet that defines the connector position and size.

Returns
Type Description
IShape

The IShape object that represents the new connector.

Examples
IRange targetRange = worksheet.Range["B12:D12"];
IShape connector = worksheet.Shapes.AddConnector(ConnectorType.Curve, targetRange);
connector.Name = "FlowConnector";

AddConnector(string, ConnectorType, double, double, double, double)

Creates a connector and returns the IShape object that represents the new connector.

Use this method to add a connector by specifying the coordinates of its starting and end points. The coordinate values are measured in points relative to the upper-left corner of the document.

Declaration
IShape AddConnector(string name, ConnectorType type, double beginX, double beginY, double endX, double endY)
Function AddConnector(name As String, type As ConnectorType, beginX As Double, beginY As Double, endX As Double, endY As Double) As IShape
Parameters
Type Name Description
string name

The connector name.

ConnectorType type

The connector type to add.

double beginX

The horizontal position (in points) of the connector's starting point relative to the upper-left corner of the document.

double beginY

The vertical position (in points) of the connector's starting point relative to the upper-left corner of the document.

double endX

The horizontal position (in points) of the connector's end point relative to the upper-left corner of the document.

double endY

The vertical position (in points) of the connector's end point relative to the upper-left corner of the document.

Returns
Type Description
IShape

The IShape object that represents the new connector.

Examples
IShape startShape = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 60, 40);
IShape endShape = worksheet.Shapes.AddShape(AutoShapeType.Rectangle, 160, 100, 60, 40);
IShape connector = worksheet.Shapes.AddConnector("Connector1", ConnectorType.Straight, 80, 40, 160, 120);
connector.ConnectorFormat.BeginConnect(startShape, 3);
connector.ConnectorFormat.EndConnect(endShape, 1);

AddConnector(string, ConnectorType, IRange)

Creates a connector at the specified range on the current sheet.

The sheet of targetRange and the sheet where the shape is added must be the same sheet. Returns the IShape object that represents the new connector.

Declaration
IShape AddConnector(string name, ConnectorType type, IRange targetRange)
Function AddConnector(name As String, type As ConnectorType, targetRange As IRange) As IShape
Parameters
Type Name Description
string name

The connector name.

ConnectorType type

The connector type to add.

IRange targetRange

The target range on the current sheet.

Returns
Type Description
IShape

The IShape object that represents the new connector.

Examples
IRange targetRange = worksheet.Range["B2:D6"];
IShape shape = worksheet.Shapes.AddConnector("Connector1", ConnectorType.Elbow, targetRange);
shape.ConnectorFormat.Type = ConnectorType.Curve;