TX Sheet Control

Ribbon and Contextual Commands

Topic

Formatting cells, inserting a chart, preparing a printed report, designing a mail merge template: the ribbon of the spreadsheet editor holds the commands for each of these, grouped in tabs. Contextual tabs such as Table Design and Chart Design appear when the selection calls for them.

The sections below walk through every tab with its groups and an example task. The screenshots use the sales and invoice sample documents.

How the Ribbon Works

The ribbon collects the commands for the current selection:

  • Select first. Select cells before formatting, a table cell before changing a table or a chart before editing its design. Review the selected address or object before you apply a change.
  • Unavailable commands. A command can be unavailable when the selection, sheet protection or the configuration of the host application prevents the operation.
  • Undo and redo. Commands participate in the supported undo and redo. Observe the document events when your application needs to react to edits.
  • Narrow editors. On a narrow editor, a group such as Font, Number or Styles may collapse to one button. Open that button to see the same commands.

On touch devices, including landscape and wide mobile layout viewports, the classic ribbon displays one row of group tiles with readable labels. Swipe the command row horizontally to reach more groups, then tap a tile to open its complete controls. The classic touch command frame stays 112 CSS pixels high across tabs. Compact touch mode uses one 60-pixel command row with touch-sized controls. Opening group popups does not resize the worksheet. Compact and tabs-only views remain available through the display handle.

Classic mobile ribbon with readable Clipboard, Font, Alignment and Number group tiles

In the preview website, click an image to open it at full size.

Choose a Ribbon View

The small handle at the right end of the tab strip opens Ribbon Display Options. Choose Classic Ribbon for the full command groups or Compact Ribbon for a single row of common commands. In compact view, the ellipsis at the end of each group opens its complete controls. On a narrow editor, scroll the command row horizontally. Dropdowns retain their complete text labels. Inline checkbox settings keep their labels and context, and input fields use the same styling as classic view.

Compact Home ribbon with common font, alignment and editing commands

Show Tabs Only keeps the tab strip visible and opens a temporary command panel when you select a tab. Click outside the ribbon or press Escape to dismiss the panel. Ctrl+F1 switches between expanded commands and tabs-only; the selected classic or compact density is retained. These views also apply to the dashboard ribbon.

Tabs-only ribbon with the Home commands temporarily open over the worksheet

Configure Ribbon Commands

Use the ribbon constructor option to choose the initial view and disable or hide built-in commands. This browser TypeScript example creates a report editor with a compact ribbon, disables Reporting and Clipboard and hides Italic. Deploy the font catalog at the URL shown before using the example.

import { Spreadsheet } from '@txtextcontrol/tx-sheet-control';

function createReportEditor(host: HTMLElement) {
    const editor = new Spreadsheet(host, {
        height: 600,
        fontCatalogURL: '/assets/sheet/fonts/catalog.json',
        ribbon: {
            layout: 'compact',
            displayMode: 'expanded',
            tabs: { reporting: { enabled: false } },
            groups: { 'home.clipboard': { enabled: false } },
            buttons: { 'home.font.italic': { visible: false } },
        },
    });
    editor.workbook.sheets.at(0).cell('A1').setText('Sales report');
    return editor;
}

The RibbonOptions maps use language-independent IDs. Obtain them from editor.ui.ribbon.items. Groups and controls have fully scoped IDs, such as home.font and home.font.bold. Catalog labels follow the current UI language; use IDs as configuration keys. Hidden contextual commands are included, and context-specific gallery choices can appear when created.

Apply later changes through configure. Omitted values remain unchanged, so re-enable an item explicitly or call reset() to clear all policies and restore classic, expanded commands.

import type { Spreadsheet } from '@txtextcontrol/tx-sheet-control';

function enableClipboard(editor: Spreadsheet) {
    editor.ui.ribbon.configure({
        groups: { 'home.clipboard': { enabled: true } },
        buttons: { 'home.font.bold': { enabled: false } },
    });
    editor.ui.ribbon.displayMode = 'tabs-only';
}

A false parent policy applies to its descendants: enabling a button cannot override a disabled group or tab. Hidden commands are also removed from group overflow. Enabling policy does not override protection or an unavailable selection. Invalid IDs and values throw before the patch changes any settings.

Ribbon settings belong to the editor and survive workbook loads; they are not saved in workbook data. These UI policies do not restrict workbook API calls or keyboard editing. Use worksheet protection for document editing rules. editor.ui.ribbon.visible hides the entire ribbon, independently of item policies; reset() preserves that setting.

Angular accepts the same ribbon object through its options input and merges supplied ribbon settings when those options change. In ASP.NET Core, set TXSheetControlOptions.Ribbon to an anonymous object with camelCase property names; Razor forwards it to the browser constructor.

Home: Everyday Cell Editing

Home ribbon showing the groups Clipboard, Font, Alignment, Number, Styles, Cells and Editing

GroupWhat to use it forExample
ClipboardCopy, cut and paste a selectionCopy a formula to the next reporting period
FontFamily, size, emphasis, borders and colorsGive a heading a bold font and a contrasting fill
AlignmentHorizontal and vertical alignment, wrapping, orientation and mergingWrap a long product description inside its column
NumberDisplay category, currency and accounting formats, percent, grouping and decimal placesShow the Revenue column as dollars without changing its numeric values
StylesConditional Formatting and reusable cell stylesAdd data bars to compare account revenue
CellsInsert and delete cells, rows and columns; access formatting commandsAdd another line to a worksheet report
EditingCommon editing, selection and lookup commandsLocate a value before editing it

Small launchers at the bottom of the Font, Alignment and Number groups open the shared Format Cells dialog. Use the dialog when a change needs several settings together. Conditional formatting shows the visual difference between direct styles and calculated rules.

The fonts the editor offers come from the configured font deployment.

Insert: Add Objects to a Worksheet

Insert ribbon with table, illustration, chart, sparkline and cell-feature commands: Table, Pictures, Shapes, Recommended Charts, the chart families, the Line, Column and Win/Loss sparklines, Hyperlink and Cell Type

Start with a data range when you insert a table or a chart. The objects of this tab differ:

  • A table adds named columns and filtering to the range.
  • A chart visualizes the values of its source.
  • Pictures and shapes are placed over the worksheet.
  • Sparklines show compact trends in cells.

For example, select the Region and Revenue columns on Summary, choose a chart family and review the chart dialog before you confirm. Selecting the inserted chart then shows Chart Design. The document objects behind these commands are described in tables, charts and drawings.

Page Layout: Prepare the Printed Report

Page Layout ribbon with worksheet page and print controls: Margins, Orientation, Size, Print Area, Breaks, Scale to Fit, the gridline and heading options, the workbook views and the Freeze Panes and Unfreeze Panes commands

Choose the paper size, orientation, margins, print area and scaling of the active worksheet. These are settings saved in the document. Changing the display zoom of the editor only changes the view on the screen.

A useful workflow for a sales report:

  1. Select the report range.
  2. Set the print area.
  3. Choose landscape orientation.
  4. Fit the report to one page wide.
  5. Review the result in Page Layout view before the PDF export.

A tall report can remain several pages high. Forcing both the width and the height to one page can make its text too small.

Data: Work With Structured Inputs

Data ribbon with sorting, filtering, transformation and validation commands: Sort, Filter, Clear, Reapply, Advanced, Text to Columns, Remove Duplicates, Consolidate, Generate Dashboard, From Selection and Data Validation

Use sorting and filtering to inspect records, and the transformation commands to prepare data. Sorting changes the order of the rows. Filtering hides the rows that don't match without deleting them. Preview operations such as splitting text or removing duplicates before you apply a change to existing cells.

Data Validation describes the acceptable input for a selection. For instance, select Units and allow whole numbers between 1 and 500. The validation guide illustrates the dialog and explains prompts and error messages. For row-based workflows, use sorting and filtering.

Formulas: Build and Inspect Calculations

Formulas ribbon with Name Manager, Trace Precedents, Trace Dependents, Remove Arrows, Highlight Dependents and Calculate Now

  • Name Manager makes repeated formulas easier to read with named cells and ranges.
  • Trace Precedents shows the cells a formula uses.
  • Trace Dependents shows the formulas that use the selected cell.
  • Remove Arrows clears this visual aid.
  • Calculate Now requests a recalculation.

The Formula Designer button beside the formula bar finds functions, accepts arguments and shows a preview of the result. The formula bar also accepts a known formula directly.

In the sales example, Revenue is Units multiplied by Price, and the total is SUM(F4:F27). Select the total before you open the designer, so that its destination and its current formula are clear. More on this in Formula Designer, calculation and names.

Highlight Formula Dependents After Editing

Editing B2 highlights the directly and indirectly dependent formulas in C2, D2 and E2 in green

Formulas → Formula Auditing → Highlight Dependents enables brief green feedback after a cell value or formula changes. Both direct dependents and formulas farther down the reference chain are included. The highlight fades after about 1.4 seconds. Its position follows scrolling, zoom, merges and frozen or split panes. Reduced-motion mode displays a brief static highlight.

Use the API to keep the setting synchronized with your application:

editor.ui.highlightDependents = true;
const sheet = editor.workbook.sheets.at(0);
sheet.cell('B1').setFormula('=A1*2');
sheet.cell('C1').setFormula('=B1+10');
sheet.cell('A1').setValue(25);

Set highlightDependents: false in the editor constructor options to start with the effect disabled. This editor preference survives workbook loads and never changes saved cell formatting or exported output.

Review: Annotate and Protect

Review ribbon with comment, note, protection and accessibility commands, including Read Worksheet Data, Worksheet Objects, Keyboard Help and Check Accessibility

Comments and notes attach explanations to cells. Protect Sheet controls the permitted worksheet operations. Select a cell before you add an annotation, and review the allowed actions before you apply protection to the sheet.

The Locked and Hide Formulas settings in Format Cells → Protection describe how cells behave when worksheet protection is enabled. They do not encrypt a workbook. See comments and notes and protection.

Reporting: Turn a Worksheet Into a Reusable Template

Reporting ribbon with clearly separated Insert Merge Field and Insert Merge Block captions, dropdown arrows, field properties and merge-block commands

Connect sample JSON, insert a merge field into a selected cell or define a repeating block for a detail row:

  • Field Properties adjusts the path and the value type of a field.
  • The repeating-block commands map one template row, or a band of rows, to an array such as items.

The invoice example binds the customer name to customer.name and repeats the description, quantity and unit price for each invoice item. Formula cells calculate the line amounts and the final total. See the illustrated mail merge workflow.

Table Design: Commands for the Selected Table

Table Design ribbon for SalesData with the table name, Resize Table, Remove Duplicates, Convert to Range, the table style options and the Table Styles gallery

Click inside a table to show this contextual tab. Change the name and the range of the table, and choose the options for the header, totals, stripes, emphasis and filter buttons. The style gallery groups its presets under Light, Medium and Dark:

Expanded table-style gallery showing the Light, Medium and Dark presets and the Clear command

A table style changes the presentation of the table. It does not replace the formulas of calculated columns or convert the table to plain cells. You can change individual display options separately from the chosen style. See Excel-style tables.

Chart Design: Commands for the Selected Worksheet Chart

Chart Design ribbon with chart style, data, type and location commands: Change Colors, the Chart Styles gallery, Switch Row/Column, Select Data, Change Chart Type and Move Chart

Click a worksheet chart to show Chart Design. Choose its style and colors, switch the series orientation, select another source range, change the chart type or move the chart to another worksheet. Select Data and Change Chart Type open the shared chart dialog with the current settings.

A worksheet chart and a dashboard chart are authored in different ways: worksheet charts use the chart dialogs, and dashboard charts use Widget Settings.

Dashboard: Design the Selected Dashboard

Dashboard ribbon with Insert, Themes, Background, Default Card Style, Layout and Alignment and Settings groups

Selecting a dashboard in design mode opens Dashboard. This tab contains commands for the whole dashboard: add or generate widgets, choose one of 24 Light, Medium or Dark themes from the categorized Themes gallery, change canvas colors and gradients, set default card appearance and arrange the widgets. Widget Spacing and Grid Row Height control the shared grid. Dashboard Settings opens the complete settings dialog for section containers, parameters and detailed gradients.

Theme defaults apply to widgets that inherit them. An individual widget's appearance overrides those defaults. Use Reset Individual Widget Appearance in Dashboard Settings when every widget should inherit the same theme.

Widget Format: Commands for the Selected Dashboard Widget

Widget Format contextual ribbon for a chart, with widget commands, data and visualization, shared font and number controls, card styles and chart display options

Select a widget on the canvas in design mode to open Widget Format. Use Dashboard to return to commands for the whole dashboard; switching ribbon tabs keeps the selected widget. Widget Format is unavailable when no widget is selected.

GroupCommon tasks
WidgetOpen Widget Settings, duplicate the widget or remove it.
Data & VisualizationChange a chart's visualization or the query aggregation.
Format and NumberChange fonts, emphasis, text and fill colors and number formatting using the shared spreadsheet controls.
Card, Gradient and DisplaySet border color and width, corner radius, shadow, a two-color gradient, title visibility and text alignment.
Chart Styles and Chart OptionsChoose a palette, position the legend and toggle data labels, animation and gridlines. These groups appear for charts.
KPISet a target or choose a comparison measure already present in the widget query. This group appears for key metrics.
Date FilterChoose a date range or searchable dates and the calendar granularity. This group appears for date filter widgets.

Ribbon edits apply immediately and can be undone. Widget Settings keeps complex queries, comparison and trend queries, drill hierarchies, actions and metric choices together in a draft until you choose Apply. Gradient shortcuts use two color stops; the dialog supports additional stops and angle settings.

At narrower widths, groups collapse into buttons that open their existing controls. Use the arrow keys, Home and End to switch between focused ribbon tabs. View mode hides both authoring panels and the ribbon tab selector, while keeping permitted filtering and data exploration.

See dashboard designer and viewer and the Widget Settings tour.

Accessibility Commands

The worksheet Review tab includes an Accessibility group. Each command has a distinct icon for its workflow: a worksheet and eye, worksheet objects, a keyboard and question mark, or an accessibility figure with a check. Read Worksheet Data presents formatted values in an HTML table; Worksheet Objects offers selection, chart data and size/position controls; Keyboard Help lists navigation commands; Check Accessibility reviews content alternatives and explicit text contrast. See Keyboard and Accessibility for the complete workflows.

Show or Hide Editor Areas

A host application can show or hide areas of the editor with editor.ui.areas, the areas property of EditorUi. Hiding the ribbon or a tab area does not remove document data.

Next Steps