- SpreadJS Overview
- Getting Started
- JavaScript Frameworks
- Best Practices
-
Features
- Workbook
- Worksheet
- Rows and Columns
- Headers
- Cells
- Data Binding
- TableSheet
- GanttSheet
-
ReportSheet
-
Template Sheet Settings
- Set Template Cell Type
- Set Spill Mode
- Apply Cell Expansion
- Set Spill Direction
- Set Pin
- Set Cell Context
- Set Filter Condition
- Sort Cell Data
- Auto Fit Template Cell
- Change Cell Styles
- Apply Conditional Formatting
- Add Data Validation
- Change Cell States
- Add Show/Collapse Button
- Show Hidden Row and Col
- ReportSheet Formula Functions
- Configure Data Entry Settings
- Set Pagination
- Configure Layout Settings
- Add Picture Shape
- Report Sheet Settings
- Report Sheet Data Entry Support
- Report Sheet Data Charts
-
Template Sheet Settings
- Data Charts
- JSON Schema with SpreadJS
- SpreadJS File Format
- Data Validation
- Conditional Formatting
- Sort
- Group
- Formulas
- Serialization
- Keyboard Actions
- Shapes
- Floating Objects
- Barcodes
- Charts
- Sparklines
- Tables
- Pivot Table
- Slicer
- Theme
- Culture
- AI Assistant
- SpreadJS Designer
- SpreadJS Designer Component
- SpreadJS Collaboration Server
- Touch Support
- Formula Reference
- Import and Export Reference
- Frequently Used Events
- API Documentation
- Release Notes
ReportSheet Formula Functions
ReportSheet uses context when setting formulas in cells. When a context is set for a cell in preview mode, then the same context is used to calculate formulas. This indicates that the same formula can produce different results depending on the context.
The following code sample shows the different formula results applied to the C2 cell in various contexts.
templateSheet.setFormula(1, 3, "=C2");
// Context is B2, B2 is the salesman, so C2 will return the current salesman's sales.
templateSheet.setFormula(2, 2, "=SUM(C2)");
// Context is A2, A2 is the region, so C2 will return the current region's sales as an array.
templateSheet.setFormula(2, 3, "=C2");
// No Context, so C2 will return all sales as an array.
templateSheet.setFormula(4, 3, "=C2");
templateSheet.setFormula(5, 3, "SUM(C2)");
reportSheet.refresh();The below image depicts how this context affects formula calculation.
RS-functions
With the Hierarchical Cell Indexes formula, you can get cell values, indexes, or rankings in a structured cell arrangement. ReportSheet also provides functions for pagination information, such as the current page number and page count.
Additionally, you can define template cell aliases which makes it easier to reuse formulas in ReportSheet.