# Spreadsheet Tools

The Telerik Blazor Spreadsheet organizes all its tools in a tool set with one or more tool set items. This article describes the built-in Spreadsheet tools and how to define custom tools.

> caption In this article:

* [The building blocks of the Spreadsheet tool set](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#tool-set)
* [The built-in Spreadsheet tools](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#built-in-tools)
* [How to customize a built-in tool set](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#customize-built-in-tool-sets)
* [How to define a custom tool set from scratch](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#create-a-custom-tool-set)
* [How to create a custom tool](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#define-custom-tools)

## Tool Set

The top of the Spreadsheet component displays a Menu and a ToolBar:

* The Menu and the ToolBar make up the Spreadsheet *tool set* (`SpreadsheetToolSet`).
* The tool set has an `Items` property and includes one or more *tool set items* (`SpreadsheetToolSetItem`). Each Menu item points to one tool set item.
* Each tool set item includes one or more *tools* (`SpreadsheetTool`).

The `SpreadsheetToolSetItem` class has the following properties:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Property Name | Type                    | Description                                                                                   |
| ------------- | ----------------------- | --------------------------------------------------------------------------------------------- |
| `Title`       | `string`                | The tool set name. Regard this as a single Menu item.                                         |
| `Tools`       | `List<SpreadsheetTool>` | The collection of tools in the tool set item. Regard this collection as one ToolBar instance. |

The Spreadsheet provides ready-to-use `SpreadsheetToolSet` objects, for example, `SpreadsheetToolSets.All`. A tool set provides a specific distribution and order of tools across tool set items. However, each tool can exist in any tool set item.

## Built-in Tools

The following table lists all Spreadsheet tools, sorted by their default tool set and order index.

| Tool Name              | Class Name                       | Default Tool Set |
| ---------------------- | -------------------------------- | ---------------- |
| Open                   | `SpreadsheetOpenFileTool`        | File             |
| Download               | `SpreadsheetDownloadFileTool`    | File             |
| Undo                   | `SpreadsheetUndoTool`            | Home             |
| Redo                   | `SpreadsheetRedoTool`            | Home             |
| Font Family            | `SpreadsheetFontFamilyTool`      | Home             |
| Font Size              | `SpreadsheetFontSizeTool`        | Home             |
| Bold                   | `SpreadsheetBoldTool`            | Home             |
| Italic                 | `SpreadsheetItalicTool`          | Home             |
| Underline              | `SpreadsheetUnderlineTool`       | Home             |
| Text Color             | `SpreadsheetTextColorTool`       | Home             |
| Background Color       | `SpreadsheetBackgroundColorTool` | Home             |
| Horizontal Align       | `SpreadsheetHorizontalAlignTool` | Home             |
| Vertical Align         | `SpreadsheetVerticalAlignTool`   | Home             |
| Text Wrap              | `SpreadsheetTextWrapTool`        | Home             |
| Number and Date Format | `SpreadsheetNumberFormatTool`    | Format           |
| Decrease Decimals      | `SpreadsheetDecreaseDecimalTool` | Format           |
| Increase Decimals      | `SpreadsheetIncreaseDecimalTool` | Format           |
| Insert Link            | `SpreadsheetInsertLinkTool`      | Insert           |
| Insert Image           | `SpreadsheetInsertImageTool`     | Insert           |
| Merge Cells            | `SpreadsheetMergeCellsTool`      | View             |
| Toggle Grid Lines      | `SpreadsheetGridLinesTool`       | View             |

The Spreadsheet component provides a few tools that have no specific action:

| Tool Name | Class Name                 | Description                                                                           |
| --------- | -------------------------- | ------------------------------------------------------------------------------------- |
| Separator | `SpreadsheetToolSeparator` | The Separator tool inserts a visible border between other tools in the same tool set. |
| Custom    | `SpreadsheetCustomTool`    | The Custom tool allows you to add custom content to a Spreadsheet tool set.           |

## Customize Built-in Tool Sets

The Spreadsheet uses Telerik Blazor components to create its built-in tool sets and tools. You can add, remove, and reorder tools in the built-in tool sets. You can also customize the exposed tool properties.

The example below shows how to:

* Get the **File** and **Home** tool set items. The built-in tool set items are distinguishable by their index or `Title`. The title can change in localized applications, so you may need to use the [`ITelerikStringLocalizer` service](https://www.telerik.com/blazor-ui/documentation/globalization/localization) to search for the localized `Title` string.
* Change the label of the **File** tool set item.
* Obtain reference to a few built-in tools inside the **Home** tool set item. You can find tools by their type or order index. Using order index is not future-proof, as the built-in tool sets can change.
* Set the `Data` property of the **Font Family** and **Font Size** tools to change the available drop down options.
* Set the `Colors` property of the **Text Color** and **Background Color** tools to change the available color palettes.
* Disable or remove the **Text Wrap** tool.

> caption Customizing tools from the default Spreadsheet tool set

<demo metaUrl="client/spreadsheet/tools/example-3/" height="770"></demo>

## Create a Custom Tool Set

Here is how to define a custom tool set from scratch. You can also [set the available properties of each tool](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#customize-built-in-tool-sets), such as `Class`, `Enabled`, `Icon`, and `Title`.

1. Set the Spreadsheet `Tools` parameter to a new `SpreadsheetToolSet` instance, for example, `SpreadsheetTools`.
2. Set the `Items` property of `SpreadsheetTools` to a `new List<SpreadsheetToolSetItem>()`.
3. Add one or more `SpreadsheetToolSetItem` objects to the `Items` list.
4. Populate each `SpreadsheetToolSetItem` object with [built-in tools](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#built-in-tools) or [custom tools](https://www.telerik.com/blazor-ui/documentation/components/spreadsheet/tools#define-custom-tools).

> caption Creating a custom tool set collection from scratch

<demo metaUrl="client/spreadsheet/tools/example-2/" height="420"></demo>

## Define Custom Tools

The `SpreadsheetCustomTool` type has a `Template` property that is a `RenderFragment`. Generally, custom tools can do one of the following:

* Perform actions that relate to the Spreadsheet component, loaded Excel document, or app business logic.
* Modify the Excel document programmatically with the help of [RadSpreadProcessing](https://www.telerik.com/blazor-ui/documentation/integrations/document-processing-libraries).

> caption Creating custom Spreadsheet tools

<demo metaUrl="client/spreadsheet/tools/example-1/" height="770"></demo>

## See Also

* [Live Demo: Spreadsheet Tools](https://demos.telerik.com/blazor-ui/spreadsheet/tools)
