[]
        
(Showing Draft Content)

GC.Spread.Sheets.FloatingObjects.FloatingObjectCollection

Class: FloatingObjectCollection

Sheets.FloatingObjects.FloatingObjectCollection

Table of contents

Constructors

Methods

Constructors

constructor

new FloatingObjectCollection(sheet?, typeName?)

Represents a floating object manager that managers all floating objects in a sheet.

Parameters

Name Type Description
sheet? Worksheet The worksheet.
typeName? string The type name.

Methods

add

add(floatingObjectOrName, src?, x?, y?, width?, height?): FloatingObject

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.

example

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

Parameters

Name Type Description
floatingObjectOrName string | FloatingObject The floating object that will be added to the sheet, or the name of the picture that will be added to the sheet.
src? string The image source of the picture.
x? number The x location of the picture.
y? number The y location of the picture.
width? number The width of the picture.
height? number The height of the picture.

Returns

FloatingObject

The floating object that has been added to the sheet.


all

all(): FloatingObject[]

Gets all of the floating objects in the sheet.

example

activeSheet.pictures.add("p1", "pics/download.jpg", 1, 6, 400, 400);
activeSheet.pictures.add("p2", "pics/download.jpg", 500, 150, 200, 300);
var pictures = activeSheet.pictures.all();
for (var i = 0; i < pictures.length; i++) {
    alert("Path of picture " + i + " is:  " + pictures[i].src())
}

Returns

FloatingObject[]

The collection of all the floating objects in the sheet.


clear

clear(): void

Removes all floating objects in the sheet.

Returns

void


get

get(name): FloatingObject

Gets a floating object from the sheet by the indicate name.

example

activeSheet.pictures.add("f2","tsoutline.png",100,60,200,100);
//button
$("#button1").click(function () {
 var pic = activeSheet.pictures.get("f2");
});

Parameters

Name Type Description
name string The name of the floating object.

Returns

FloatingObject

The floating object in the sheet with the indicate name.


remove

remove(name): void

Removes a floating object from the sheet by the indicate name.

example

activeSheet.pictures.add("f2","tsoutline.png",100,60,200,100);
//button
$("#button1").click(function () {
     activeSheet.resumePaint();
     activeSheet.pictures.remove("f2");
     activeSheet.repaint();
});

Parameters

Name Type Description
name string The name of the floating object.

Returns

void


zIndex

zIndex(name, zIndex?): any

Gets or sets the z-index of floating object.

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 20, 20, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button1";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
var customFloatingObject1 = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f2", 5, 5, 30, 64);
var btn1 = document.createElement('button');
btn1.style.width = "60px";
btn1.style.height = "30px";
btn1.innerText = "button2";
customFloatingObject1.content(btn1);
activeSheet.floatingObjects.add(customFloatingObject1);
activeSheet.floatingObjects.zIndex("f2", 897);
activeSheet.floatingObjects.zIndex("f1", 898);

Parameters

Name Type Description
name string The name of the floatingObject.
zIndex? number The z-index of the floating object.

Returns

any

If the parameter 'zIndex' is null or undefined,it will return the z-index of the floating object with the indicate name.