Managing Sheet with APIs

SheetAPI.applyTableTpl



applyTableTpl(hd, sheetId, startRow, startCol, endRow, endCol, tpl, trigger)

SheetAPI.applyTableTpl method is used to apply table template to a range of cells.

Parameters The handle information of the Sheet application your created. The specific sheet id. startRow is the start row number. startCol is the start column number. endRow is the end row number. endCol is the end column number. This is one of string from tpl_0 to tpl_59. Tpl can be selected from tpl_0 to tpl_59 with different color and style for the table. For light color, id is from tpl_0 to tpl_20. For dark color, id is from tpl_21 to tpl_48. For deep dark color, id is from tpl_49 to tpl_59. true or false. Default is true which means trigger is enabled.

Example code to apply table template to cells


var json =  {
    fileName: 'Table Sheet',
    sheets: [
        {name: 'One tab', id: 1, color: 'orange' }
    ],
    cells: [
	{sheet: 1, row: 16, col: 6, json: { data: "CATEGORY" }},
	{sheet: 1, row: 16, col: 7, json: { data: "ESTIMATED"}},
	{sheet: 1, row: 16, col: 8, json: { data: "ACTUAL" }},
	{sheet: 1, row: 17, col: 6, json: { data: "Bouquets"}},
	{sheet: 1, row: 17, col: 7, json: { data: "500"}},
	{sheet: 1, row: 17, col: 8, json: { data: "450" }},
	{sheet: 1, row: 18, col: 6, json: { data: "Boutonnires" } },
	{sheet: 1, row: 18, col: 7, json: { data: "200" }},
	{sheet: 1, row: 18, col: 8, json: { data: "150" }},
	{sheet: 1, row: 19, col: 6, json: { data: "Corsages"}},
	{sheet: 1, row: 19, col: 7, json: { data: "100"}},
	{sheet: 1, row: 19, col: 8, json: { data: "80" }}
    ]
};
	
SHEET_API.loadData(SHEET_API_HD, json, function() {
   	SHEET_API.applyTableTpl(SHEET_API_HD, 1, 16, 6, 19, 8, "tpl_50", false);
}, this);
    
applyTableTpl should be called after data are successfully rendered.

 

 


Copyright © FeyaSoft Inc. All rights reserved.