SpreadJS Documentation
add Method
GC.Spread.Sheets.Shapes Namespace > ShapeCollection type : add Method
The name of the shape. If leave blank an unique name will be generated.
The type of the shape (for one of the buildin types) or the model for custom shape.
The x location of the shape.
The y location of the shape.
The width of the shape.
The height of the shape.
Add a new shape to shape collection
Syntax
var instance = new GC.Spread.Sheets.Shapes.ShapeCollection(sheet);
var value; // Type: Shape
value = instance.add(name, autoShapeTypeOrModel, left, top, width, height);
function add( 
   name : string,
   autoShapeTypeOrModel : undefined,
   left : number,
   top : number,
   width : number,
   height : number
) : Shape;

Parameters

name
The name of the shape. If leave blank an unique name will be generated.
autoShapeTypeOrModel
The type of the shape (for one of the buildin types) or the model for custom shape.
left
The x location of the shape.
top
The y location of the shape.
width
The width of the shape.
height
The height of the shape.
Example
// This example shows how to add a new shape
var shape = activeSheet.shapes.add("shape1", GC.Spread.Sheets.Shapes.AutoShapeType.heart, 100, 50, 100, 150);
See Also

Reference

ShapeCollection type