Columns and cell properties
This section covers the methods to manage the properties from a cell or a spreadsheet column.
Documentation
Section titled “Documentation”Methods
Section titled “Methods”| Method | Description |
|---|---|
| getProperty | Get the properties of one cell. @param column - cell column. @param row - cell row. Jspreadsheet getProperty( <br>column: number, <br>row: number <br>): Promise<{ [property: string]: any }> 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 |
| 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
Section titled “Examples”Column properties
Section titled “Column properties”Update the column properties
Section titled “Update the column properties”import { Client } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// New propertiesconst properties = { type: "checkbox", title: "Column A", width: "100px",};
// Change the properties from the forth columnspreadsheet.setProperty([{ column: 3, options: properties }]).then(() => { // It worked correctly}).catch((err) => { // Something went wrong console.log(err);});Read the properties of a column
Section titled “Read the properties of a column”import { Client } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get the properties from the first columnspreadsheet.getProperty(0).then((properties) => { console.log(properties);});
// {// '0': {// type: "text",// width: "47",// }// }Read the properties of multiple columns
Section titled “Read the properties of multiple columns”import { Client } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get the properties from multiple columnsspreadsheet.getProperty([0, 1]).then((properties) => { console.log(properties);});