[]
↳ ConnectorShape
• new ConnectorShape(worksheet
, name
, connectorType?
, beginX?
, beginY?
, endX?
, endY?
)
Represents a ConnectorShape.
Name | Type | Description |
---|---|---|
worksheet |
Worksheet |
The host sheet of the shape. |
name |
string |
The name of shape. |
connectorType? |
ConnectorType |
The type of the connector shape. |
beginX? |
number |
The x location of the start point for the connector shape. |
beginY? |
number |
The y location of the start point for the connector shape. |
endX? |
number |
The x location of the end point for the connector shape. |
endY? |
number |
The y location of the end point for the connector shape. |
▸ adjustments(arrayValue?
): any
Gets or sets the adjustment values of the connector shape.
example
var myConnector = sheet.shapes.addConnector("myConnector", GC.Spread.Sheets.Shapes.ConnectorType.elbow, 50, 50, 200, 500);
var adjustments = myConnector.adjustments();
console.log(adjustments);
adjustments = [-0.8];
myConnector.adjustments(adjustments);
Name | Type | Description |
---|---|---|
arrayValue? |
number [] |
The adjustment values in array. |
any
if no value is set, returns the current adjustment values of the shape.
▸ allowMove(value?
): any
Gets or sets whether to disable moving the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.allowMove();
heart.allowMove(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The setting for whether to disable moving the shape. |
any
If no value is set, returns the setting for whether to disable moving the shape.
▸ allowResize(value?
): any
Gets or sets the resize mode of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.allowResize();
heart.allowResize(GC.Spread.Sheets.Shapes.ResizeMode.aspect);
Name | Type | Description |
---|---|---|
value? |
boolean | ResizeMode |
The setting for whether to disable resizing the shape. |
any
If no value is set, returns the setting for whether to disable resizing the shape.
▸ allowRotate(value?
): any
Gets or sets whether to disable rotating the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.allowRotate();
heart.allowRotate(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The setting for whether to disable rotating the shape. |
any
If no value is set, returns the setting for whether to disable rotating the shape.
▸ alt(value?
): any
Gets or sets the alternative text of the shape for screen readers.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
heart.alt("A heart shape");
Name | Type |
---|---|
value? |
string |
any
The alternative text of the shape.
▸ canPrint(value?
): any
Gets or sets whether this shape is printable.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.canPrint(); // Get whether the shape is printable, defaulat value is true.
workbook.print(); // The heart shape is printed.
heart.canPrint(false);
workbook.print(); // The heart shape is not printed.
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether this shape is printable.
▸ dynamicMove(value?
): any
Gets or sets whether the shape moves when hiding or showing, resizing, or moving rows or columns.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.dynamicMove();
heart.dynamicMove(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The value indicates whether the shape moves when hiding or showing, resizing, or moving rows or columns. |
any
If no value is set, returns whether this shape dynamically moves.
▸ dynamicSize(value?
): any
Gets or sets whether the size of the shape changes when hiding or showing, resizing, or moving rows or columns.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.dynamicSize();
heart.dynamicSize(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The value indicates whether the size of the shape changes when hiding or showing, resizing, or moving rows or columns. |
any
If no value is set, returns whether this shape dynamically changes size.
▸ endColumn(value?
): any
Gets or sets the end column index of the shape position.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.endColumn();
heart.endColumn(n + 1);
Name | Type | Description |
---|---|---|
value? |
number |
The end column index of the shape position. |
any
If no value is set, returns the end column index of the shape position.
▸ endColumnOffset(value?
): any
Gets or sets the offset relative to the end column of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.endColumnOffset();
heart.endColumnOffset(0);
Name | Type | Description |
---|---|---|
value? |
number |
The offset relative to the end column of the shape. |
any
If no value is set, returns the offset relative to the end column of the shape.
▸ endConnector(connector?
): IShapeConnector
Gets or sets the end connector info of the connectorShape.
example
var shape1 = sheet.shapes.add("myShape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 62 * 9, 0, 200, 200);
var shape2 = sheet.shapes.addConnector("myShape", GC.Spread.Sheets.Shapes.ConnectorType.straight, 220, 120, 300, 120);
shape2.endConnector({name: shape1.name(), index: 2});
console.log(shape2.endConnector());
Name | Type | Description |
---|---|---|
connector? |
IShapeConnector |
The end connector info of the connectorShape. |
connectorInfo - If no value is set, returns the end connector info of the connectorShape. When the connectorShape has no end connector returns null. connectorInfo.name The name of the end connector. connectorInfo.index The connect point index of the end connector. connectorInfo.shape The end connector.
▸ endRow(value?
): any
Gets or sets the end row index of the shape position.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.endRow();
heart.endRow(n + 2);
Name | Type | Description |
---|---|---|
value? |
number |
The end row index of the shape position. |
any
If no value is set, returns the end row index of the shape position.
▸ endRowOffset(value?
): any
Gets or sets the offset relative to the end row of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.endRowOffset();
heart.endRowOffset(0);
Name | Type | Description |
---|---|---|
value? |
number |
The offset relative to the end row of the shape. |
any
If no value is set, returns the offset relative to the end row of the shape.
▸ getFormula(path
): string
Gets the formula string from the shape by the path.
example
sheet.name("Sheet1");
sheet.setValue(0, 1, "red");
var myConnector = sheet.shapes.addConnector("myConnector", GC.Spread.Sheets.Shapes.ConnectorType.elbow, 50, 50, 200, 500);
myConnector.setFormula("style.line.color", "=Sheet1!B1");
myConnector.getFormula("style.line.color");//returns "=Sheet1!B1"
Name | Type | Description |
---|---|---|
path |
string |
The path which can accept a formula string, it could be one of "x", "y", "width", "height", "style.line.color", "style.line.lineStyle", "style.line.width", "style.line.capType", "style.line.joinType", "style.line.compoundType", "style.line.transparency". |
string
Returns the formula string from the shape by the path.
▸ height(value?
): any
Gets or sets the height of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.height();
heart.height(n + 50);
Name | Type | Description |
---|---|---|
value? |
string | number |
The height of the shape specified by a number or formula (starts with =) can get a number value. |
any
If no value is set, returns the height of the shape.
▸ hyperlink(value?
): void
| IHyperlink
Gets or sets the hyperlink of the shape.
example
var shape = sheet.shapes.add("myShape", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 62 * 9, 0, 200, 200);
shape.hyperlink({url: "http://www.spreadjs.com", target: 0, tooltip: 'goes to SpreadJS'});
Name | Type |
---|---|
value? |
IHyperlink |
void
| IHyperlink
If no value is set, returns the current hyperlink settings of the shape.
▸ isLocked(value?
): any
Gets or sets whether this shape is locked.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.isLocked();
heart.isLocked(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The value that indicates whether this shape is locked. |
any
If no value is set, returns whether this shape is locked.
▸ isSelected(value?
): any
Gets or sets whether this shape is selected.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.isSelected();
heart.isSelected(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The value that indicates whether this shape is selected. |
any
If no value is set, returns whether this shape is selected.
▸ isVisible(value?
): any
Gets or sets whether this shape is visible.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.isVisible();
heart.isVisible(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The value that indicates whether this shape is visible. |
any
If no value is set, returns whether this shape is visible.
▸ name(value?
): any
Gets or sets the name of the shape.
example
var shape1 = sheet.shapes.add("myShape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 62 * 9, 0, 200, 200);
var shape2 = sheet.shapes.add("myShape2", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 20, 20, 200, 200);
var shape = sheet.shapes.group([shape1, shape2]);
shape.name("myGroupShape");
var shapeName = shape.name();
Name | Type | Description |
---|---|---|
value? |
string |
The name of the shape. |
any
If no value is set, returns the name of the shape.
▸ setFormula(path
, formula
): void
Sets the formula string to the shape by the path.
example
sheet.name("Sheet1");
sheet.setValue(0, 1, "red");
var myConnector = sheet.shapes.addConnector("myConnector", GC.Spread.Sheets.Shapes.ConnectorType.elbow, 50, 50, 200, 500);
myConnector.setFormula("style.line.color", "=Sheet1!B1");
Name | Type | Description |
---|---|---|
path |
string |
The path which can accept a formula string, it could be one of "x", "y", "width", "height", "style.line.color", "style.line.lineStyle", "style.line.width", "style.line.capType", "style.line.joinType", "style.line.compoundType", "style.line.transparency". |
formula |
string |
The formula string. |
void
▸ showHandle(value?
): any
Gets or sets whether to show handle of shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var state = heart.showHandle();
heart.showHandle(!state);
Name | Type | Description |
---|---|---|
value? |
boolean |
The setting for whether to show handle of shape. |
any
If no value is set, returns the setting for whether to show handle of shape.
▸ startColumn(value?
): any
Gets or sets the starting column index of the shape position.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.startColumn();
heart.startColumn(n + 2);
Name | Type | Description |
---|---|---|
value? |
number |
The starting column index of the shape position. |
any
If no value is set, returns the starting column index of the shape position.
▸ startColumnOffset(value?
): any
Gets or sets the offset relative to the start column of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.startColumnOffset();
heart.startColumnOffset(0);
Name | Type | Description |
---|---|---|
value? |
number |
The offset relative to the start column of the shape. |
any
If no value is set, returns the offset relative to the start column of the shape.
▸ startConnector(connector?
): IShapeConnector
Gets or sets the start connector info of the connectorShape.
example
var shape1 = sheet.shapes.add("myShape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 62 * 9, 0, 200, 200);
var shape2 = sheet.shapes.addConnector("myShape", GC.Spread.Sheets.Shapes.ConnectorType.straight, 220, 120, 300, 120);
shape2.startConnector({name: shape1.name(), index: 2});
console.log(shape2.startConnector());
Name | Type | Description |
---|---|---|
connector? |
IShapeConnector |
The start connector info of the connectorShape. |
connectorInfo - If no value is set, returns the start connector info of the connectorShape. When the connectorShape has no start connector returns return null. connectorInfo.name The name of the start connector. connectorInfo.index The connect point index of the start connector. connectorInfo.shape The start connector.
▸ startRow(value?
): any
Gets or sets the starting row index of the shape position.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.startRow();
heart.startRow(n + 2);
Name | Type | Description |
---|---|---|
value? |
number |
The starting row index of the shape position. |
any
If no value is set, returns the starting row index of the shape.
▸ startRowOffset(value?
): any
Gets or sets the offset relative to the start row of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.startRowOffset();
heart.startRowOffset(0);
Name | Type | Description |
---|---|---|
value? |
number |
The offset relative to the start row of the shape. |
any
If no value is set, returns the offset relative to the start row of the shape.
▸ style(value?
): void
| ShapeStyle
Gets or sets the style of the connector shape.
example
//This sample sets style for the connector shape.
var shape = sheet.shapes.addConnector("Shape1", GC.Spread.Sheets.Shapes.ConnectorType.straight, 100, 60, 200, 160);
var oldStyle = shape.style();
oldStyle.line.color = "red";
oldStyle.line.lineStyle = GC.Spread.Sheets.Shapes.PresetLineDashStyle.dashDot;
oldStyle.line.width = 5;
oldStyle.line.capType = GC.Spread.Sheets.Shapes.LineCapStyle.square;
oldStyle.line.joinType = GC.Spread.Sheets.Shapes.LineJoinStyle.miter;
oldStyle.line.compoundType = GC.Spread.Sheets.Shapes.CompoundType.double;
oldStyle.line.transparency = 0.5;
oldStyle.line.beginArrowheadStyle = GC.Spread.Sheets.Shapes.ArrowheadStyle.triangle;
oldStyle.line.beginArrowheadWidth = GC.Spread.Sheets.Shapes.ArrowheadWidth.narrow;
oldStyle.line.beginArrowheadLength = GC.Spread.Sheets.Shapes.ArrowheadLength.short;
oldStyle.line.endArrowheadStyle = GC.Spread.Sheets.Shapes.ArrowheadStyle.diamond;
oldStyle.line.endArrowheadWidth = GC.Spread.Sheets.Shapes.ArrowheadWidth.wide;
oldStyle.line.endArrowheadLength = GC.Spread.Sheets.Shapes.ArrowheadLength.long;
shape.style(oldStyle);
Name | Type | Description |
---|---|---|
value? |
ShapeStyle |
The connector shape style. |
void
| ShapeStyle
If no value is set, returns the current style of the connector shape.
▸ toImageSrc(): string
Get the shape Image src of type Base64 string.
example
let shapeImageSrc = sheet.shapes.all()[0].toImageSrc();
string
return the shape Image Base64 src string.
▸ type(): ConnectorType
Gets the connector type of the connectorShape.
example
var shape = sheet.shapes.addConnector("myShape", GC.Spread.Sheets.Shapes.ConnectorType.straight, 220, 120, 300, 120);
var shapeName = shape.type();
returns the connector type of the shape.
▸ width(value?
): any
Gets or sets the width of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.width();
heart.width(n + 50);
Name | Type | Description |
---|---|---|
value? |
string | number |
The width of the shape specified by a number or formula (starts with =) can get a number value. |
any
If no value is set, returns the width of the shape.
▸ x(value?
): any
Gets or sets the horizontal location of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.x();
heart.x(n + 50);
Name | Type | Description |
---|---|---|
value? |
string | number |
The horizontal location of the shape specified by a number or formula (starts with =) can get a number value. |
any
If no value is set, returns the horizontal location of the shape.
▸ y(value?
): any
Gets or sets the vertical location of the shape.
example
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.y();
heart.y(n + 50);
Name | Type | Description |
---|---|---|
value? |
string | number |
The vertical location of the shape specified by a number or formula (starts with =) can get a number value. |
any
If no value is set, returns the vertical location of the shape.