# EJ2 Spreadsheet (Spreadsheet Editor)

## Overview

The **EJ2 Spreadsheet** is a web-based Excel-like control for **viewing, editing, formatting, calculating, and managing structured data** inside the browser. It provides an interactive grid UI with a workbook/sheet model and a full calculation engine. It supports **JavaScript/TypeScript, Angular, React, Vue, and ASP.NET Core/MVC**.

The component supports two primary data flows:

1. Users can construct spreadsheet content programmatically by providing a JSON-based workbook model during initialization.  
This data is loaded directly into the client-side Spreadsheet model without involving a server.  
Use this mode when the application is generating or manipulating spreadsheet content entirely on the client.

2. The Spreadsheet supports loading external documents such as Excel files (xlsx, xls, xlsm, xlsb) or CSV files through a server-based import process. 

This data flow operates as follows:

1. The client sends a file or URL to the server.  
2. The server uses Syncfusion XlsIO to convert the file into a JSON workbook model.  
3. The client receives the JSON and loads it into the Spreadsheet for display and editing.  
4. Users can edit, add, delete, or update data, formulas, and formatting.  
5. When saving, the client sends the updated workbook model back to the server.  
6. The server converts the JSON model into an actual Excel file or CSV file and returns it to the user.


The component follows a layered design:

- **Spreadsheet Layer (UI)**: Rendering, selection, interaction, editing
- **Workbook Layer (Model)**: Sheet, row, column, cell objects, formatting, range operations, undo/redo
- **Calculate Layer (Engine)**: Formula parsing, dependency graph, recalculation

The Spreadsheet supports importing, editing, and exporting Excel files, binding to local or remote data, working with large datasets, and applying spreadsheet features similar to Excel. The Spreadsheet is used for data entry tools, dashboards, financial models, form-driven apps, reporting systems, data management UIs, and Excel-compatible workflows.

## Functional Overview

The component offers:

- Excel-compatible workbook structure (multiple sheets)
- Interactive editing (cell editing, selection, autofill, keyboard navigation)
- Data import/export and print
- Complex calculation engine
- Data binding (local, remote, cell-level)
- Full formatting capabilities
- Charting and image embedding
- Data validation rules
- Protection features
- Performance optimizations for large datasets
- Customizable user interface (ribbon, context menu, templates)

---

## Key Features

The Syncfusion EJ2 Spreadsheet offers:

- Cell editing through UI or API
- Formulas and a built-in calculation engine
- Data binding (local, remote, cell-level)
- Number formatting and text formatting
- Conditional formatting
- Data validation rules
- Clipboard operations (cut, copy, paste)
- Find and replace
- Autofill and fill series
- Sorting and filtering
- Insert/delete rows and columns
- Show/hide rows and columns
- Freeze panes
- Notes and Comments.
- Merge cells and wrap text
- Hyperlinks, notes, and threaded comments
- Sheet management (add, delete, rename, visibility)
- Images, charts, and shape insertion
- Protection: sheet, workbook structure, read-only ranges
- Keyboard navigation and keyboard shortcuts
- Context menu and ribbon UI with customization.
- Adaptive layout for mobile devices
- Localization, globalization, and RTL support
- Print support

## Supported File Formats

The Spreadsheet can load and save the following formats, typically through server-side processing using Syncfusion XlsIO:

- Excel formats: xlsx, xls, xlsm, xlsb
- CSV files
- PDF export (via server)

Import and export preserve formatting, formulas, styles, and sheet structure. The server converts Excel files to a JSON model consumed by the client.

## Calculation Engine

The Calculate engine includes:

- Formula parser and token generator
- Dependency graph for recalculation
- Automatic and manual calculation modes
- Custom (user-defined) formulas
- Cross-sheet formula support
- Named ranges support
- Error handling for invalid formulas and circular references

## Architecture Summary

The Spreadsheet is composed of three major layers:

1. UI Layer Responsibilities: rendering, DOM updates, interactions, selection, context menus, ribbon, dialogs, undo/redo.

2. Model Layer Responsibilities: workbook, sheet, row, column, cell models; mutations; formatting; data binding

3. Calculate Engine Responsibilities: formula parsing, evaluation, dependency graph, recalculation

## Typical Use Cases

- Excel-like data entry and analysis tools
- Import/export workflows leveraging Excel files
- Financial, budgeting, and forecasting applications
- Reporting dashboards with spreadsheet UI
- Import/export workflows based on Excel files
- Custom form builders using spreadsheet logic
- Apps requiring high-performance grid editing with formulas

## Document Status

Purpose: Provide a stable, high-level product description of the EJ2 Spreadsheet component.  
Scope: Covers major product features, data operations, architecture, and supported workflows.  
Update Frequency: Low (product-level information; stable across releases)