[]
        
(Showing Draft Content)

GC.Spread.Sheets.Shapes.FormControlShape

Class: FormControlShape

Sheets.Shapes.FormControlShape

Hierarchy

  • Shape

    FormControlShape

Table of contents

Constructors

Methods

Constructors

constructor

new FormControlShape(worksheet, formControlType, left?, top?, width?, height?)

Parameters

Name Type Description
worksheet Worksheet The host worksheet of the shape.
formControlType FormControlType -
left? number -
top? number -
width? number -
height? number -

Overrides

Shape.constructor

Methods

adjustments

adjustments(arrayValue?): void | number[]

Gets or sets the adjustment values of the shape.

example

var blockArc = sheet.shapes.add("", GC.Spread.Sheets.Shapes.AutoShapeType.blockArc, 100, 60, 200, 160);
var adjustments = blockArc.adjustments();
console.log(adjustments);
adjustments[0] = 150;
adjustments[1] = 15;
adjustments[2] = 0.35;
blockArc.adjustments(adjustments);
blockArc.isSelected(true);

Parameters

Name Type Description
arrayValue? number[] The adjustment values in array.

Returns

void | number[]

if no value is set, returns the current adjustment values of the shape.

Inherited from

Shape.adjustments


allowMove

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);

Parameters

Name Type Description
value? boolean The setting for whether to disable moving the shape.

Returns

any

If no value is set, returns the setting for whether to disable moving the shape.

Inherited from

Shape.allowMove


allowResize

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);

Parameters

Name Type Description
value? boolean | ResizeMode The setting for whether to disable resizing the shape.

Returns

any

If no value is set, returns the setting for whether to disable resizing the shape.

Inherited from

Shape.allowResize


allowRotate

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);

Parameters

Name Type Description
value? boolean The setting for whether to disable rotating the shape.

Returns

any

If no value is set, returns the setting for whether to disable rotating the shape.

Inherited from

Shape.allowRotate


alt

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");

Parameters

Name Type
value? string

Returns

any

The alternative text of the shape.

Inherited from

Shape.alt


canPrint

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.

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether this shape is printable.

Inherited from

Shape.canPrint


dynamicMove

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);

Parameters

Name Type Description
value? boolean The value indicates whether the shape moves when hiding or showing, resizing, or moving rows or columns.

Returns

any

If no value is set, returns whether this shape dynamically moves.

Inherited from

Shape.dynamicMove


dynamicSize

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);

Parameters

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.

Returns

any

If no value is set, returns whether this shape dynamically changes size.

Inherited from

Shape.dynamicSize


enabled

enabled(v?): boolean

Gets or Sets the enabled of form control shape.

Parameters

Name Type
v? boolean

Returns

boolean


endColumn

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);

Parameters

Name Type Description
value? number The end column index of the shape position.

Returns

any

If no value is set, returns the end column index of the shape position.

Inherited from

Shape.endColumn


endColumnOffset

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);

Parameters

Name Type Description
value? number The offset relative to the end column of the shape.

Returns

any

If no value is set, returns the offset relative to the end column of the shape.

Inherited from

Shape.endColumnOffset


endRow

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);

Parameters

Name Type Description
value? number The end row index of the shape position.

Returns

any

If no value is set, returns the end row index of the shape position.

Inherited from

Shape.endRow


endRowOffset

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);

Parameters

Name Type Description
value? number The offset relative to the end row of the shape.

Returns

any

If no value is set, returns the offset relative to the end row of the shape.

Inherited from

Shape.endRowOffset


formControlType

formControlType(): FormControlType

Gets FormControl specific type.

Returns

FormControlType


getFormula

getFormula(path): string

Gets the formula string from the shape by the path.

example

sheet.name("Sheet1");
sheet.setValue(0, 1, "This is a rectangle.");
var shape1 = sheet.shapes.add("myShape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 100, 200, 200);
shape1.setFormula("text", "=Sheet1!B1");
shape1.getFormula("text");//returns "=Sheet1!B1"

Parameters

Name Type Description
path string The path which can accept a formula string, it could be one of "x", "y", "width", "height", "rotate", "text", "style.fill.color", "style.fill.transparency", "style.fill.src", "style.fill.tilePictureAsTexture", "style.fill.offsetLeft", "style.fill.offsetRight", "style.fill.offsetTop", "style.fill.offsetBottom", "style.fill.offsetX", "style.fill.offsetY", "style.fill.scaleX", "style.fill.scaleY", "style.fill.alignment", "style.fill.mirrorType", "style.fill.type", "style.fill.angle", "style.fill.direction", "style.fill.stops.0.color", "style.fill.stops.0.position", "style.fill.stops.0.transparency", "style.fill.stops.0.brightness", "style.line.color", "style.line.lineStyle", "style.line.width", "style.line.capType", "style.line.joinType", "style.line.compoundType", "style.line.transparency", "style.textEffect.color", "style.textEffect.transparency", "style.textEffect.font", "style.textFrame.vAlign", "style.textFrame.hAlign".

Returns

string

Returns the formula string from the shape by the path.

Inherited from

Shape.getFormula


height

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);

Parameters

Name Type Description
value? string | number The height of the shape specified by a number or formula (starts with =) can get a number value.

Returns

any

If no value is set, returns the height of the shape.

Inherited from

Shape.height


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'});

Parameters

Name Type
value? IHyperlink

Returns

void | IHyperlink

If no value is set, returns the current hyperlink settings of the shape.

Inherited from

Shape.hyperlink


isLocked

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);

Parameters

Name Type Description
value? boolean The value that indicates whether this shape is locked.

Returns

any

If no value is set, returns whether this shape is locked.

Inherited from

Shape.isLocked


isSelected

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);

Parameters

Name Type Description
value? boolean The value that indicates whether this shape is selected.

Returns

any

If no value is set, returns whether this shape is selected.

Inherited from

Shape.isSelected


isTextBox

isTextBox(value?): boolean | void

Gets or sets the shape is text box.

example

var rectangle = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 60, 200, 160);
rectangle.isTextBox(true);

Parameters

Name Type
value? boolean

Returns

boolean | void

If no value is set, return whether shape is a text box.

Inherited from

Shape.isTextBox


isVisible

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);

Parameters

Name Type Description
value? boolean The value that indicates whether this shape is visible.

Returns

any

If no value is set, returns whether this shape is visible.

Inherited from

Shape.isVisible


name

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();

Parameters

Name Type Description
value? string The name of the shape.

Returns

any

If no value is set, returns the name of the shape.

Inherited from

Shape.name


options

options(v?): IFormControlShapeOptions

Gets or Sets the options of form control shape.

Parameters

Name Type
v? IFormControlShapeOptions

Returns

IFormControlShapeOptions


rotate

rotate(value?): number | void

Gets or sets the rotated angle of the shape (unit in degree).

example

var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.rotate();
heart.rotate(n + 30);

Parameters

Name Type Description
value? string | number The rotated angle of the shape (unit in degree) specified by a number or formula (starts with =) can get a number value.

Returns

number | void

If no value is set, returns the rotated angle of the shape (unit in degree).

Inherited from

Shape.rotate


setFormula

setFormula(path, formula): void

Sets the formula string to the shape by the path.

example

sheet.name("Sheet1");
sheet.setValue(0, 1, "This is a rectangle.");
var shape1 = sheet.shapes.add("myShape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 100, 200, 200);
shape1.setFormula("text", "=Sheet1!B1");

Parameters

Name Type Description
path string The path which can accept a formula string, it could be one of "x", "y", "width", "height", "rotate", "text", "style.fill.color", "style.fill.transparency", "style.fill.src", "style.fill.tilePictureAsTexture", "style.fill.offsetLeft", "style.fill.offsetRight", "style.fill.offsetTop", "style.fill.offsetBottom", "style.fill.offsetX", "style.fill.offsetY", "style.fill.scaleX", "style.fill.scaleY", "style.fill.alignment", "style.fill.mirrorType", "style.fill.type", "style.fill.angle", "style.fill.direction", "style.fill.stops.0.color", "style.fill.stops.0.position", "style.fill.stops.0.transparency", "style.fill.stops.0.brightness", "style.line.color", "style.line.lineStyle", "style.line.width", "style.line.capType", "style.line.joinType", "style.line.compoundType", "style.line.transparency", "style.textEffect.color", "style.textEffect.transparency", "style.textEffect.font", "style.textFrame.vAlign", "style.textFrame.hAlign".
formula string The formula string.

Returns

void

Inherited from

Shape.setFormula


showHandle

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);

Parameters

Name Type Description
value? boolean The setting for whether to show handle of shape.

Returns

any

If no value is set, returns the setting for whether to show handle of shape.

Inherited from

Shape.showHandle


startColumn

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);

Parameters

Name Type Description
value? number The starting column index of the shape position.

Returns

any

If no value is set, returns the starting column index of the shape position.

Inherited from

Shape.startColumn


startColumnOffset

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);

Parameters

Name Type Description
value? number The offset relative to the start column of the shape.

Returns

any

If no value is set, returns the offset relative to the start column of the shape.

Inherited from

Shape.startColumnOffset


startRow

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);

Parameters

Name Type Description
value? number The starting row index of the shape position.

Returns

any

If no value is set, returns the starting row index of the shape.

Inherited from

Shape.startRow


startRowOffset

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);

Parameters

Name Type Description
value? number The offset relative to the start row of the shape.

Returns

any

If no value is set, returns the offset relative to the start row of the shape.

Inherited from

Shape.startRowOffset


style

style(value?): any

Gets or sets the style of the shape.

example

//This sample sets style for the shape.
var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var oldStyle = heart.style();
oldStyle.fill.color = "red";
oldStyle.fill.transparency = 0.5;
oldStyle.line.color = "green";
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.textEffect.color = "yellow";
oldStyle.textEffect.transparency = 0.5;
oldStyle.textEffect.font = "20px Arial";
oldStyle.textFrame.vAlign = GC.Spread.Sheets.VerticalAlign.center;
oldStyle.textFrame.hAlign = GC.Spread.Sheets.HorizontalAlign.center;
heart.style(oldStyle);
heart.text("Heart");

Parameters

Name Type Description
value? ShapeStyle The shape style.

Returns

any

If no value is set, returns the current style of the shape.

Inherited from

Shape.style


text

text(value?): any

Gets or sets the text of the shape.

example

var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
heart.text("My Shape");
var s = heart.text();

Parameters

Name Type Description
value? string The text of the shape specified by a string or formula (starts with =) can get a string.

Returns

any

If no value is set, returns the text of the shape.

Inherited from

Shape.text


type

type(value?): any

Gets or sets the type of the shape.

example

var heart = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 60, 200, 160);
var n = heart.type();
heart.type(GC.Spread.Sheets.Shapes.AutoShapeType.cloud);

Parameters

Name Type Description
value? AutoShapeType The type of the shape.

Returns

any

If no value is set, returns the type of the shape.

Inherited from

Shape.type


value

value(v?): IFormControlShapeValue

Gets or Sets the value of form control shape.

Parameters

Name Type
v? IFormControlShapeValue

Returns

IFormControlShapeValue


width

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);

Parameters

Name Type Description
value? string | number The width of the shape specified by a number or formula (starts with =) can get a number value.

Returns

any

If no value is set, returns the width of the shape.

Inherited from

Shape.width


x

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);

Parameters

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.

Returns

any

If no value is set, returns the horizontal location of the shape.

Inherited from

Shape.x


y

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);

Parameters

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.

Returns

any

If no value is set, returns the vertical location of the shape.

Inherited from

Shape.y