Table format in Vue Document editor component

14 Sep 20235 minutes to read

Document editor customizes the formatting of table, or table cells such as table width, cell margins, cell spacing, background color, and table alignment. This section describes how to customize these formatting for selected cells, rows, or table in detail.

Cell margins

You can customize the cell margins by using the following sample code.

//To change the left margin
//To change the right margin
//To change the top margin
//To change the bottom margin

You can also define the default cell margins for a table. If the specific cell margin value is not defined explicitly in the cell formatting, the corresponding value will be retrieved from default cells margin of the table. Refer to the following sample code.

//To change the left margin
//To change the right margin
//To change the top margin
//To change the bottom margin

Background color

You can explicitly set the background color of selected cells using the following sample code.


Refer to the following sample code to customize the background color of the table.


Cell spacing

Refer to the following sample code to customize the spacing between each cell in a table.


Cell vertical alignment

The content is aligned within a table cell to ‘Top’, ‘Center’, or ‘Bottom’. You can customize this property of selected cells. Refer to the following sample code.


Table alignment

The tables are aligned in document editor to ‘Left’, ‘Right’, or ‘Center’. Refer to the following sample code.


Cell width

Set the desired width of table cells that will be considered when the table is layouted. Refer to the following sample code.


Table width

You can set the desired width of a table in Point or Percent type. Refer to the following sample code.


Apply borders

Document editor exposes API to customize the borders for table cells by specifying the settings. Refer to the following sample code.

import { BorderSettings } from '@syncfusion/ej2-documenteditor';
//To apply border
let borderSettings: BorderSettings = {
            type: 'AllBorders',
            lineWidth: 12

Please check below gif which illustrates how to apply border for selected cells through properties pane options - border color, line size and no border:


Working with row formatting

14 Sep 20235 minutes to read

Document editor allows various row formatting such as height and repeat header.

Row height

You can customize the height of a table row as ‘Auto’, ‘AtLeast’, or ‘Exactly’. Refer to the following sample code.


Header row

The header row describes the content of a table. A table can optionally have a header row. Only the first row of a table can be the header row. If the cursor position is at first row of the table, then you can define whether it as header row or not, using the following sample code.


Allow row break across pages

This property is valid if a table row does not fit in the current page during table layout. It defines whether a table row can be allowed to break. If the value is false, the entire row will be moved to the start of next page. You can modify this property for selected rows using the following sample code.



Document Editor expose API to get or set the table title of the selected table. Refer to the following sample code to set title.

this.$refs.documenteditor.ej2Instances.selection.tableFormat.title = 'Shipping Details';


Document Editor expose API to get or set the table description of the selected image. Refer to the following sample code to set description.

this.$refs.documenteditor.ej2Instances.selection.tableFormat.description = 'Freight cost and shipping details';

See Also