SpreadJS Documentation
add Method
GC.Spread.Sheets.FloatingObjects Namespace > FloatingObjectCollection type : add Method
The floating object that will be added to the sheet, or the name of the picture that will be added to the sheet.
The image source of the picture.
The x location of the picture.
The y location of the picture.
The width of the picture.
The height of the picture.
Adds a floating object to the sheet. The arguments has 2 modes. If there is 1 parameter, the parameter is floatingObject which is a GC.Spread.Sheets.FloatingObjects.FloatingObject type. If there are 6 parameters, the parameters are name, src, x, y, width, and height.
Syntax
var instance = new GC.Spread.Sheets.FloatingObjects.FloatingObjectCollection(sheet, typeName);
var value; // Type: FloatingObject
value = instance.add(floatingObjectOrName, src, x, y, width, height);
function add( 
   floatingObjectOrName : undefined,
   src : string,
   x : number,
   y : number,
   width : number,
   height : number
) : FloatingObject;

Parameters

floatingObjectOrName
The floating object that will be added to the sheet, or the name of the picture that will be added to the sheet.
src
The image source of the picture.
x
The x location of the picture.
y
The y location of the picture.
width
The width of the picture.
height
The height of the picture.
Example
This example adds a floating object to the sheet.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
This example adds a floating picture.
<input type="button" id="button1" value="button1"/>

activeSheet.pictures.add("f2","tsoutline.png",100,60,200,100);

$("#button1").click(function () {
activeSheet.resumePaint();
activeSheet.pictures.remove("f2");
activeSheet.repaint();
    });
See Also

Reference

FloatingObjectCollection type