Spreadsheet footers
Footers is readonly data that goes in the footer of the spreadsheet. It can provides summary information to the user, and can include text or formulas.Documentation
Methods
The following methods are available to interact with the spreadsheet footers programmatically.Method | Description |
---|---|
getFooters | Get the footers definitions for a spreadsheet.Jspreadsheet getFooters(): Promise<(string | null)[][]> GET /api/:guid/footers
|
setFooters | Remove the current footer and apply the informed one. @param footer - new footer data. Jspreadsheet setFooters(footer: (string | undefined | null)[][]): Promise<void> POST /api/:guid/footers
|
resetFooter | Remove the footer.Jspreadsheet resetFooter(): Promise<void> DELETE /api/:guid/footers
|
setFooterValue | Change the value of a preexisting cell in the footer. @param x - cell column to be changed. @param y - cell row to be changed. @param value - new cell value. Jspreadsheet setFooterValue(x: number, y: number, value: string): Promise<void> POST /api/:guid/footers/value
|
Examples
Set the spreadsheet footers
import { Client } from "@intrasheets/client"; // Create a new client const client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i", }); // Spreadsheet Guid const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; // Get the spreadsheet instance const spreadsheet = client.getSpreadsheet(guid); // New footer const rows = [ ['1', '2'], ['3', '4'], ]; // Create the footers from the array spreadsheet.setFooters(rows).then(() => { // It worked correctly }).catch((err) => { // Something went wrong console.log(err); });
Retrieving all footers
import { Client } from "@intrasheets/client"; // Create a new client const client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i", }); // Spreadsheet Guid const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; // Get the spreadsheet instance const spreadsheet = client.getSpreadsheet(guid); // Get the footers spreadsheet.getFooters().then((footer) => { console.log(footer); }); // [["1","2"],["3","4"]]
Set the value of a footer cell
import { Client } from "@intrasheets/client"; // Create a new client const client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i", }); // Spreadsheet Guid const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; // Get the spreadsheet instance const spreadsheet = client.getSpreadsheet(guid); // Set the value of the footer cell spreadsheet.setFooterValue(1, 1, "New Value").then(() => { // It worked correctly }).catch((err) => { // Something went wrong console.log(err); });
Delete all footers
import { Client } from "@intrasheets/client"; // Create a new client const client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i", }); // Spreadsheet Guid const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; // Get the spreadsheet instance const spreadsheet = client.getSpreadsheet(guid); // Delete the footer definitions spreadsheet.resetFooter().then(() => { // It worked correctly }).catch((err) => { // Something went wrong console.log(err); });