Skip to main content

Configuration

You can adjust the desired settings of DHTMLX Spreadsheet to meet your needs. The available configuration options allow you to limit the number of rows and columns, change the toolbar appearance and control the visibility of the menu and the editing bar. You can also initialize Spreadsheet in the readonly mode, if needed.

Toolbar

The toolbar of the Spreadsheet consists of several blocks of controls that can be changed according to your needs. By default, there are the following blocks of controls in the toolbar: "undo", "colors", "decoration", "align", "format", "actions", "helpers". You can add more blocks from the list: "lock", "clear", "rows", "columns", "file".

The structure of toolbar can be adjusted via the toolbarBlocks configuration option of the component, which is an array with strings presenting the names of controls.

You can also specify your own structure of the toolbar by enumerating necessary elements in the toolbarBlocks array in the desired order, for example: "helpers", "colors", "align", "decoration", "lock", "clear".

Toolbar is highly customizable. You can add new controls, change the icons of controls and apply the desired icon pack.

Editing bar

Since the structure of Spreadsheet is flexible, you can switch on/off the editing bar to get the desired look and feel of the component. Use the editLine configuration option to hide/show the editing bar.

Number of rows and columns

When Spreadsheet is initialized, it has the initial configuration of grid which consists of 1000 columns and 25 rows. However, when this limit runs out, additional rows and columns are rendered automatically, so you don't need to add them. Nevertheless, you can specify the exact number of rows and columns in the grid, if you want to limit them. Use the colsCount and rowsCount options for this purpose.

Frozen rows and columns

You may need to fix (or "freeze") some columns or rows, so that they will become static when you scroll the page, while the rest of columns/rows remain movable.

  • To fix columns to the left side of the spreadsheet, use the leftSplit property (available from v4.0)
  • To fix rows on the top of the spreadsheet, use the topSplit property (available from v4.3)

Check the example below:

The menu of the Spreadsheet is hidden by default. You can switch it on/off via the corresponding configuration option menu:

Read-only mode

It is also possible to enable the read-only mode to prevent editing of Spreadsheet cells via the readonly configuration option.

You can also customize the readonly behavior of Spreadsheet.

Custom number formats for cells

There are 7 default formats that can be applied to the values of cells: "Common", "Number", "Percent", "Currency", "Date", "Time", "Text".

You can redefine configuration of default formats or specify your own number format via the formats config option. Check the details in the Number Formatting article.

Path to export/import modules

DHTMLX Spreadsheet provides the possibility to import/export data in the Excel format. The component uses WebAssembly-based libraries: Excel2Json and JSON2Excel for import/export of data.

After installing the necessary library, you need to set path to the worker.js file (either local or at CDN) via the corresponding configuration option - importModulePath or exportModulePath.

All the details are given in the Data Loading and Export article.