Managing Sheet with APIs

SheetAPI.insertFloatingItem



insertFloatingItem( hd, sheetTabId, config, callback, scope )

SheetAPI.insertFloatingItem method is used to insert floating item to the existing sheet tab. Currently, enterpriseSheet supports the following floating items: wedgit, chart, and image.

Parameters The handle information of the Sheet application your created. The specific sheet tab id. If it is not provided or undefined, the default value will be currently active sheet tab id.

The configuration object defines the parameters to be implemented for the floating items. See the following example for more details.

The callback function which will be called after the file is loaded. The scope for the callback function.

Example code to insert wedgit


var wedgitJson = {
    ftype: 'wedgit',
    url: 'http://www.cubedrive.com'
};
var store = SHEET_API_HD.store;
SHEET_API.insertFloatingItem(SHEET_API_HD, store.getActivedSheetId(), wedgitJson);
    

The above example will insert a wedgit into the current active sheet tab. The config item only include those two parameters.

NameDescription
ftype: 'wedgit'Name should be defined as 'wedgit'.
urlThe hyperlink of the insert wedgit.

Example code to insert image


var imageJson = {
    ftype: 'picture',
    url: 'http://www.enterprisesheet.com/resources/images/enterpriseLogo.png'
};
var store = SHEET_API_HD.store;
SHEET_API.insertFloatingItem(SHEET_API_HD, store.getActivedSheetId(), imageJson);
    

The above example will insert an image into the current active sheet tab. The config item only include those two parameters.

NameDescription
ftype: 'picture'Name should be defined as 'picture'.
urlThe hyperlink of the insert image.

Example code to insert chart


var chartJson = {
	ftype: 'chart',
	seriesPosition:'row',
	legendPosition:'right',
	chartType:'column',
	source:{
	    series:[['',8,5,8,7],['',9,5,9,7],['',10,5,10,7],['',11,5,11,7]],
	    usAbs:false
	},
	x:370,
	y:272,
	width:400,
	height:300
};
var store = SHEET_API_HD.store;
SHEET_API.insertFloatingItem(SHEET_API_HD, store.getActivedSheetId(), chartJson);
    

The above example will insert a chart into the current active sheet tab. The config item include those parameters.

NameDescription
ftype: 'chart'Name should be defined as 'chart'.
seriesPosition:'row'Chart series position: row or column
legendPosition:'right'Where legend should be: right, left, top, bottom
chartType:'column'Different kind of chart
"xTitle":"X"OPTION - ignore this if chart does not have X title
"yTitle":"Y"OPTION - ignore this if chart does not have Y title
source:{...}The source information for the chart. Includes the following items:
  • "series":[["",9,6,9,7],["",10,6,10,7],["",11,6,11,7]], // the data series position
  • "categories":[["",9,5,9,5],["",10,5,10,5],["",11,5,11,5]], // define the category of data position
  • "labels":[["",8,6,8,6],["",8,7,8,7]], // define the label of chart data position
"x":695the chart located X position
"y":164the chart located Y position
"width":400the chart width
"height":300the chart height

 

 


Copyright © FeyaSoft Inc. All rights reserved.