For the complete documentation index, see llms.txt. This page is also available as Markdown.

Spreadsheet Editor - Edit Mode

Requirements

These packages are required to use these features in production. Trial keys have unlimited access to all features

Web SDKPackage: Spreadsheet EditorLive demo

The Spreadsheet Editor is in edit mode by default. In edit mode, users can modify and interact with spreadsheets using familiar, grid-based interactions similar to Excel. Users can interact with cells, including:

  • Cell formatting: Modify text size and color, fonts, border styles, cell colors, border colors, and text styling for bold, italics, underlining, and strikethrough.

  • Formula and function support: Execute standard mathematical operations, statistical calculations, date/time functions, and other common formulas.

  • Dynamic data manipulation: Easily add, edit, and delete rows and columns. Seamlessly cut, copy, and paste data.

  • Cell adjustments: Merge cells and preserve formatting.

  • File support: Open files in XLSX, XLS, and CSV formats. Export as XLSX or PDF.

Edit mode is ideal for tasks like data entry, adjusting cell styles, and organizing sheet content.

Users can click the dropdown on the Mode flyout in the upper-right corner of the Spreadsheet Editor UI to switch between Viewing and Editing mode.

For programmatic changes, you could, for example, build a reporting dashboard that imports sales data into a spreadsheet. After the data is loaded, the app programmatically applies formatting - bold headers, alternating row colors, and column width adjustments- improving readability without requiring users to manually style the sheet. You'd use the CellRange constructor to create an instance, then apply styling with the Sheet.setCellRangeStyle API.

Spreadsheet Editor must be purchased as an add-on to your Web SDK subscription.

Screenshot of the Apryse SDK Spreadsheet Editor with labeled callouts highlighting UI features such as clipboard operations, a formula bar, cell fonts, cell styling, and sheet tabs.

Workbook

A workbook is the top-level container for all spreadsheet data. It includes multiple sheets and supports operations such as getting, creating, removing, or switching sheets. Users can interact with the workbook through the UI or programmatically using the Workbook class. The workbook instance can be retrieved with the SpreadsheetEditorManager.getWorkbook API shown in the following sample.

Get a sheet

The following code sample shows how to get a sheet with the 0-based index using the Workbook.getSheetAt API after the editor is initialized.

A sheet can also be retrieved by its name using the Workbook.getSheet API.

Create sheets

The following code sample creates a new sheet using the Workbook.createSheet API after the editor is initialized.

Remove sheets

The following code sample removes a sheet using the Workbook.removeSheet API.

Set active sheet

The following code sample sets the last sheet of the workbook to be active using the Workbook.setActiveSheet API and Workbook.sheetCount property.

Sheets

Sheets are tabbed pages within a workbook, each with its own grid of cells, or rows of cells. They help organize data into separate sections, like months, categories, or teams. Only the active sheet is visible and editable at a time. Sheets can also be managed programmatically for dynamic workflows.

A sheet instance can be retrieved from a workbook instance using the Workbook.getSheet API or Workbook.getSheetAt API.

Access rows

See the Row documentation for available APIs. The following code sample gets the first row from a sheet in a workbook.

Add rows and columns

The following code sample shows how to add rows and columns to a sheet.

Remove rows and columns

The following code sample shows how to remove rows and columns from a sheet.

Resize rows and columns

Use the Sheet.setColumnWidthInPixel API and Sheet.setRowHeightInPixel API to resize columns and rows, respectively. The following code sample sets the first column height and row width to 200px.

Cells

Cells are the basic building blocks of a spreadsheet, used to enter data, text, or formulas. Each is identified by its row and column (e.g., B2) and can be styled, merged, or formatted. Users can edit cells directly through the formula bar or programmatically via an API.

You could, for example, develop a budgeting application that programmatically reads XLSX files and applies a light-red background color to cells that don't match their expected format (e.g., invalid format, missing values). You'd use the Cell.setStyle API to change the background color of a specific cell.

Access a single cell

The following code sample shows how to access a cell programmatically using the Sheet.getCellAt API and alternatively the Row.getCellAt API.

Access currently selected cells

The following code sample demonstrates how to programmatically access the currently selected cells using the following SpreadsheetEditorManager APIs:

  • getSelectedCells API to retrieve a Cell[]

  • getSelectedCellRange API to retrieve a CellRange

Set a cell value

The following code sample shows how to set the value of a cell using different types of values, including strings, booleans, numbers, and dates. See the Cell class documentation for a detailed look at the available APIs.

Apply styles to a cell

The following code sample shows how to apply various styles to an individual cell using the Cell.setStyle API and Workbook.createFont API.

Apply styles to selected cells

The following code sample shows how to apply various styles to the actively selected cells using the SpreadsheetEditorManager.setSelectedCellsStyle API.

Cell ranges

A cell range is a collection of one or more cells in a rectangular grouping. They are defined by their first and last row and column. Use cell ranges when you want to interact with groups of cells. See CellRange class documentation.

Create a cell range

Cell ranges are created via a constructor. They are defined either by a string representation (e.g., A1:B5) or by an object specifying the first and last row and column indices.

Select a cell range

Use the SpreadsheetEditorManager.selectCellRange API to programmatically select one or more cells. Calling this API will automatically scroll the viewer to the selected cell range. The following code sample shows how to select the cell range A1:B5.

Get currently selected cell range

Use the SpreadsheetEditorManager.getSelectedCellRange API to get a CellRange representation of the currently selected cells.

Style a cell range

Use the Sheet.setCellRangeStyle API and the Sheet.setCellRangeBorder API to programmatically apply styling and borders to a cell range, respectively. Please note that calling these APIs will overwrite the existing styling. The following code sample shows how to apply a red background with dotted borders.

Formula bar

The formula bar is where users can view and edit the contents of active cells. It serves as a single-line input field that supports both plain values and formulas (e.g., =A1+B1). When a cell is selected, its content automatically appears in the formula bar for quick inspection or modification. We have a full list of supported formulas you can review to see which best support your needs.

Set a cell formula

The following code sample shows how to programmatically set a formula on a specific cell using the Cell.setFormula API.

Images

Images are stored individually in each sheet. You can read, add, and remove images from any sheet. The following image formats are supported:

  • BMP

  • GIF

  • JPEG

  • PNG

Get images

Use the Sheet.getImage API to get images from a specific sheet. With this, you can access an image's size, position, and original source. Refer to the SpreadsheetEditorImage class to see all available properties.

Add images

Use the Sheet.addImage API to add images to a specific sheet. Images can be added by passing a relative path, HTTP(S) URL, or Base64-encoded data URL. If position and size are not provided, the image is placed in the top-left corner with a default size of 250x250 pixels.

Remove images

Use the Sheet.removeImage API to remove images from a specific sheet. The following code sample shows how to remove the first image from the first sheet.

Undo and redo

The Spreadsheet Editor supports undo and redo for a variety of actions, such as:

  • Editing cell values.

  • Changing cell styles.

  • Adding or removing sheets.

  • Resizing columns and rows.

  • Moving and resizing charts.

The following code sample shows how to detect if there are actions that can be undone or redone.

Last updated

Was this helpful?