Columns and cell properties
This section covers the methods to manage the properties from a cell or a spreadsheet column.Documentation
Methods
Method | Description |
---|---|
getProperty | Get the properties of one cell. @param column - cell column. @param row - cell row. Jspreadsheet getProperty( GET /api/:guid/properties
|
getProperty | Get the properties of one or more columns. @param columns - column(s) positions. If omitted, the properties of all columns will be returned. Jspreadsheet getProperty(columns?: number | number[]): Promise<{ [columnIndex: string]: Column }> GET /api/:guid/properties
|
setProperty | Set the property of a column. All old properties are removed. @param properties.[].column - column number @param properties.[].options - properties values. If omitted, current settings will be removed. Jspreadsheet setProperty( properties: { column: number; options?: Column }[] ): Promise<void> POST /api/:guid/properties
|
setProperty | Set the property of a cell. All old properties are removed. @param properties[].column - x coordinate. @param properties[].row - y coordinate. @param properties[].options - properties values. If omitted, current settings will be removed. Jspreadsheet setProperty(properties: { column: number, row: number, options?: { [property: string]: any } }[]): Promise<void> POST /api/:guid/properties
|
updateProperty | Update the properties of a column. Only reported properties are affected. @param properties.[].column - column number @param properties.[].options - properties values Jspreadsheet updateProperty(properties: { column: number; options: Column }[] ): Promise<void> POST /api/:guid/properties/update
|
updateProperty | Update the properties of a cell. Only reported properties are affected. @param properties[].column - x coordinate. @param properties[].row - y coordinate. @param properties[].options - properties values. Jspreadsheet updateProperty(properties: { column: number, row: number, options: { [property: string]: any } }[]): Promise<void> POST /api/:guid/properties/update
|
resetProperties | Removes all properties of a cell. @param column - cell column. @param row - cell row. Jspreadsheet resetProperties(column: number, row: number): Promise<void> POST /api/:guid/properties
|
Examples
Column properties
Update the column properties
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 properties const properties = { type: "checkbox", title: "Column A", width: "100px", }; // Change the properties from the forth column spreadsheet.setProperty([{ column: 3, options: properties }]).then(() => { // It worked correctly }).catch((err) => { // Something went wrong console.log(err); });
Read the properties of a column
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 properties from the first column spreadsheet.getProperty(0).then((properties) => { console.log(properties); }); // { // '0': { // type: "text", // width: "47", // } // }
Read the properties of multiple columns
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 properties from multiple columns spreadsheet.getProperty([0, 1]).then((properties) => { console.log(properties); });