[]
SpreadJS allows users to get essential page information including the total number of pages, row count, column count, row index, and column index of each page while working with spreadsheets. This feature is useful especially when users want to know important information about the page before printing the worksheet data.
For instance, let's assume that you're working with a Financial application using Excel as a reporting tool. Now, you want to get the page information before the sheet executes the printing job and you want to create an "index page" as well. Using this feature, users can determine
The accurate page count (how many pages will be printed on the sheet) and
The print range on each printing page [that is, the page row and column information].
This will help users to print the desired data efficiently.
The following code sample shows how to get page information while working with spreadsheets.
// Initializing Spread
var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'),
{ sheetCount: 1 });
spread.suspendPaint();
// Fetch the ActiveSheet
var sheet = spread.getActiveSheet();
for (var i = 0; i < 20; i++)
{
for (var j = 0; j < 18; j++)
{
sheet.setValue(i, j, "Row" + i + " Col" + j);
}
}
spread.resumePaint();
var pageInfos = spread.pageInfo(0);
console.log("Total no. of pages: " + pageInfos.pageCount);
for (var p = 0; p < pageInfos.pageCount; p++) {
console.log("ColCount of Page[" + p + "] is: " + pageInfos.pages[p].columnCount);
console.log("RowCount of Page[" + p + "] is: " + pageInfos.pages[p].rowCount);
}