[]
        
(Showing Draft Content)

Text Decoration

SpreadJS supports multiple text decoration styles that can be applied to cell text, including standard and accounting underline types.

Text decorations are configured using the textDecoration property on a cell or a Style object.

Supported Types

Text decorations are defined by the TextDecorationType enum.

TextDecorationType is a bitwise flag enum.

Name

Value

Description

none

0

No decoration

underline

1

Single underline

lineThrough

2

Strikethrough

overline

4

Line above text

doubleUnderline

8

Double underline

accountingUnderline

16

Single accounting underline

doubleAccountingUnderline

32

Double accounting underline

image

Note:

The enum supports bitwise combinations where applicable (for example, underline | lineThrough).

Applying Text Decoration

Using getCell

activeSheet.getCell(0, 0).textDecoration(
    GC.Spread.Sheets.TextDecorationType.underline
);

activeSheet.getCell(1, 0).textDecoration(
    GC.Spread.Sheets.TextDecorationType.doubleAccountingUnderline
);

Using a Style Object

var style = new GC.Spread.Sheets.Style();
style.textDecoration =
    GC.Spread.Sheets.TextDecorationType.accountingUnderline;

activeSheet.setStyle(2, 1, style);

Standard vs Accounting Underlines

SpreadJS supports both standard underline styles and Excel‑compatible accounting underline styles.

Aspect

Standard Underlines

Accounting Underlines

Supported Types

  • Underline

  • DoubleUnderline

  • AccountingUnderline

  • DoubleAccountingUnderline

Position

Drawn directly beneath the text glyphs

Positioned further below the text baseline

Spacing

Fixed visual offset

Spacing scales proportionally with font size

Underline Width

Matches text width

Matches text width for numbers and rotated text; may span the full column width for general text

Rotation

Follows text rotation(not supported for vertical text)

Follows text rotation (not supported for vertical text)

Typical Usage

General text emphasis

Financial reports and Excel‑style accounting formatting

Behavior Notes of Accounting Underlines

  • Accounting underlines are applied at the cell level and cannot be set per rich-text segment.

  • For numeric and date-formatted values, the underline width matches the text width.

  • For general text, the underline may span the full column width.

  • In merged cells, the underline spans the entire merged width.

  • Vertical text does not render accounting underlines (consistent with Excel).

  • SpreadJS does not automatically increase row height when an accounting underline is applied.

    If the row height is insufficient, the underline may visually degrade instead.

    (In Excel, row height may increase automatically in this scenario.)

Setting Text Decoration in SpreadJS Designer

In addition to the API, text decoration can also be configured in SpreadJS Designer.

  1. Select one or more cells.

  2. Go to the Home tab.

  3. In the Font group, click the dialog launcher (small arrow icon).

    image

  4. In the Format Cells dialog, open the Font tab.

    image

  5. Use the Underline dropdown list to select:

    • Single

    • Double

    • Single Accounting

    • Double Accounting

      image

  6. Click OK to apply the setting.

Strikethrough can also be enabled in the same dialog under Effects.

image

Accounting underline types should not be combined with other underline types.

The selected underline type is applied to the entire cell and corresponds directly to the TextDecorationType enum in the API.