Table Style Custom Settings

Release 3.1.2503 and above.

Using the table template style feature provided by Synap Editor, you can edit tables more quickly and conveniently.

Setting

KeyDescription
editor.table.template.stylesSets table template styles.
editor.table.template.listSets the templates to display.

editor.table.template.styles Setting

<table> <thead> <tr><th>Key</th><th>Type</th><th>Description</th></tr> </thead> <tbody> <tr> <td><code>template name</code></td> <td>Object</td> <td>

Defines the table template style.

template name can be set as String type. You can overwrite existing styles or specify new ones.

Sub-keyTypeDescription
rowObjectDefines styles for rows.
  headObjectDefines the head row style.
    indexNumberSelects which row to apply the style to. ex) 0 → first row
    styleObjectDefines the style to express.
      colorStringSpecifies the text color. ex) 'red', 'rgb(255, 0, 0)', '#FF0000'
      backgroundColorStringSpecifies the background color. ex) 'red', 'rgb(255, 0, 0)', '#FF0000'
      bordersObjectDefines the border styles.
        topObjectborder-top definition.
          typeStringSpecifies the border style. Supported types: none | dotted | dashed | solid | double. When double, requires width ≥ 3px to render.
          widthNumberBorder width. 110 px. UI preview max shows 1px; actual table uses configured width.
          colorStringBorder color.
        bottom / left / rightObjectSame shape as top. If bottom omitted, uses top. If left omitted, uses top. If right omitted, uses left then top.
  highlightObjectDefines alternate-row highlight style (isEven, style).
    isEvenBooleantrue: even rows / false: odd rows.
colObjectDefines styles for columns. Same shape as row.
defaultStyleObjectDefines the default cell style.
tableStyleObjectDefines the style applied to the table itself.

Style priority: headRow > headCol > highlightRow > highlightCol > defaultStyle

</td> </tr> </tbody> </table>

editor.table.template.list Setting

<table> <thead> <tr><th>Key</th><th>Type</th><th>Description</th><th>Setting</th><th>Preview</th></tr> </thead> <tbody> <tr> <td><code>popup</code></td> <td>ArrayList</td> <td>

Defines the table template list to be shown in the table creation popup.

Up to 4 templates can be shown per row using a nested array.

</td> <td>
popup: [
    ['Basic', 'Gray Column Header', 'Gray Row Header', 'Dual Header'],
    ['Sideless Zebra', 'Sideless GrayScale', 'GrayScale', 'Striped Black Row Header']
]
</td> <td>

Table popup preview

</td> </tr> <tr> <td><code>dialog</code></td> <td>ArrayList</td> <td>

Defines the table template list to be shown in the [Style & Header Cells] tab of the table properties dialog.

Up to 4 templates can be shown per row using a nested array.

</td> <td>
dialog: [
    ['Basic', 'Dashed', 'GrayScale', 'Zebra'],
    ['Sideless', 'Sideless Zebra', 'Sideless GrayScale', 'Sideless Black'],
    ['Gray Column Header', 'Dashed Gray Column Header', 'Dual Header', 'Dashed Dual Header'],
    ['Gray Row Header', 'Dashed Gray Row Header', 'Sideless Black Row Header', 'Striped Black Row Header']
]
</td> <td>

Table dialog preview

</td> </tr> </tbody> </table>

Notes

  • When 5 or more templates are entered in each array, only the first 4 template styles are displayed.
  • Unregistered template keys are not displayed when added.

Default Style Types

<table> <tbody> <tr> <td>

Basic

Basic

</td> <td>

Dashed

Dashed

</td> <td>

GrayScale

GrayScale

</td> <td>

Zebra

Zebra

</td> </tr> <tr> <td>

Sideless

Sideless

</td> <td>

Sideless Zebra

Sideless Zebra

</td> <td>

Sideless GrayScale

Sideless GrayScale

</td> <td>

Sideless Black

Sideless Black

</td> </tr> <tr> <td>

Gray Column Header

Gray Column Header

</td> <td>

Dashed Gray Column Header

Dashed Gray Column Header

</td> <td>

Dual Header

Dual Header

</td> <td>

Dashed Dual Header

Dashed Dual Header

</td> </tr> <tr> <td>

Gray Row Header

Gray Row Header

</td> <td>

Dashed Gray Row Header

Dashed Gray Row Header

</td> <td>

Sideless Black Row

Sideless Black Row

</td> <td>

Striped Black Row Header

Striped Black Row Header

</td> </tr> </tbody> </table>

View Detail Settings

Application Example

var synapEditorConfig = {
    'editor.table.template.styles': {
        'Dark Mode': {
            defaultStyle: {
                color: 'rgb(220, 220, 220)',
                backgroundColor: 'rgb(30, 30, 30)',
                borders: {
                    top: {
                        type: 'solid',
                        width: 1,
                        color: 'rgb(60, 60, 60)'
                    }
                }
            }
        },
        'Rainbow': {
            row: {
                head: {
                    index: 0,
                    style: {
                        backgroundColor: 'red',
                        borders: {
                            top: {
                                type: 'solid',
                                width: 1,
                                color: 'black'
                            }
                        }
                    }
                },
                highlight: {
                    isEven: true,
                    style: {
                        backgroundColor: 'yellow',
                        borders: {
                            top: {
                                type: 'solid',
                                width: 1,
                                color: 'black'
                            }
                        }
                    }
                }
            },
            defaultStyle: {
                color: 'white',
                backgroundColor: 'blue',
                borders: {
                    top: {
                        type: 'solid',
                        width: 1,
                        color: 'black'
                    }
                }
            }
        }
    },
    'editor.table.template.list': {
        popup: [
            ['Basic', 'Gray Column Header', 'Gray Row Header', 'Dual Header'],
            ['Sideless Zebra', 'Sideless GrayScale', 'GrayScale', 'Striped Black Row Header'],
            ['Dark Mode', 'Rainbow']
        ],
        dialog: [
            ['Basic', 'Dashed', 'GrayScale', 'Zebra'],
            ['Sideless', 'Sideless Zebra', 'Sideless GrayScale', 'Sideless Black'],
            ['Gray Column Header', 'Dashed Gray Column Header', 'Dual Header', 'Dashed Dual Header'],
            ['Gray Row Header', 'Dashed Gray Row Header', 'Sideless Black Row Header', 'Striped Black Row Header'],
            ['Dark Mode', 'Rainbow']
        ]
    }
}
<table> <thead> <tr><th>Popup</th><th>Dialog</th></tr> </thead> <tbody> <tr> <td>

Rainbow popup

</td> <td>

Rainbow dialog

</td> </tr> </tbody> </table>