Creating Tables

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Row)
(Cell Properties: Screenshot updated to v3.6.1, rewording around percent values)
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Creating a table ==
+
{{#CUSTOMTITLE:Creating Tables}}
 +
__TOC__
 +
A table is a perfect format for some types of data, including statistical information. CKEditor not only lets you add and edit this document element in a quick and easy way but also offers advanced customization options.
  
If you want to create a table in CKEditor you must press the "Insert/Edit Table" [[Image:CKEditor_table.png‎]]button on the toolbar.<br>
+
== Creating a Table ==
 +
To create a table in CKEditor, press the [[Image:CKEditor_table.png|Table‎]] button on the toolbar. The '''Table Properties''' dialog window that will open lets you set configuration options that define table size, its display properties, or other advanced properties.
  
After that a popup window called "Table Properties" will appear. It incules two bookmarks.<br>
+
The '''Table Properties''' dialog window includes two tabs that group table options:
 +
* [[CKEditor 3.x/Users Guide/Rich Text/Tables#Table_Properties|Table Properties]]
 +
* [[CKEditor 3.x/Users Guide/Rich Text/Tables#Advanced|Advanced]]
  
<br>
+
{{CKEditor Dialog Windows}}
  
 
=== Table Properties ===
 
=== Table Properties ===
 +
The '''Table Properties''' tab is the default tab that opens after you press the [[Image:CKEditor_table.png‎|Table]] button on the toolbar. It allows you to set the table dimensions and configure the way it will appear in the document.
  
[[Image:CKEditor_table_popup.png|Table properties]]<br>
+
[[Image:CKEditor_table_properties.png|frame|center|Table Properties dialog window with the default tab open]]
  
* '''Rows''': in this field you specify number of rows in the table.<br>
 
* '''Columns''': specifies number of columns in the table.<br>
 
* '''Width''': sets the width of user table in pixels or percentage. E.g. Choosing 40 percent table takes 40% of the editing area width.<br>
 
* '''"Height''': sets the height of user table in pixels.<br>
 
* '''Headers''':  specifies how headers look like. User may choose following option "First Line", "First column", "Both". <br>
 
* '''Border size''': sets the thickness of the tables border.<br>
 
* '''Alignment''': specifies the alignment of the table. Three options available: left, center and right.<br>
 
* '''Cell spacing''': specifies thickness of the cell’s border.
 
* '''Cell padding''': sets the hight of the cell.
 
* '''Caption''': specifies the title of the table. The title appears in the top of the table.
 
* '''Summary''': sets a comment on the table.The comment does not appear in the table. It is only meant for usage.
 
  
Not all options are required to build a table. User is asked to fill only Rows and Columns. Filling the rest of the fields is optional. It may be used or not, depending on User’s needs.
+
Below is an overview of all '''Table Properties''' tab elements:
 +
* '''Rows''' &ndash; the number of rows in the table (obligatory).
 +
* '''Columns''' &ndash; the number of columns in the table (obligatory).
  
 +
* '''Width''' &ndash;  the width of the table in pixels or a percent value. Giving the width as a percent value lets you set the proportion of the [[CKEditor_3.x/Users Guide/Interface/Editing Area|editing area]] that the table will occupy.
 +
* '''Height''' &ndash; the height of the table in pixels.
 +
 +
* '''Headers''' &ndash; the drop-down list that formats certain table cells as headers, which applies special formatting to them. You can apply header formatting to '''First Row''', '''First Column''' or '''Both'''.
 +
* '''Border size''' &ndash; the thickness of the table border in pixels.
 +
* '''Alignment''' &ndash; the alignment of the table on the page. The following options are available: '''Left''', '''Center''', '''Right'''.
 +
 +
* '''Cell spacing''' &ndash; the space between individual cells as well as cells and table borders, in pixels.
 +
* '''Cell padding''' &ndash; the space between the cell border and its contents, in pixels.
 +
 +
* '''Caption''' &ndash; the label of the table that is displayed on top of it.
 +
* '''Summary''' &ndash; the summary of the table contents that is available for assistive devices like screen readers. It is a good practice to provide your tables with meaningful summary text in order to make it more [[CKEditor_3.x/Users_Guide/Accessibility|accessible]] to users with disabilities.
  
 
=== Advanced ===
 
=== Advanced ===
 +
The '''Advanced''' tab lets you configure additional image options such as assign it an ID, a class, a language direction, or CSS style properties. It is meant for advanced users with knowledge of HTML as well as CSS, and gives nearly endless possibilities as far as the presentation of the table is concerned.
 +
 +
[[Image:CKEditor_table_advanced.png|frame|center|Advanced tab of the Table Properties window]]
 +
 +
 +
Below is an overview of all '''Advanced''' tab elements:
 +
* '''Id''' &ndash; a unique identifier for a table element in the document (<code>id</code> attribute).
 +
* '''Language Direction''' &ndash; the direction of the text in the table: left to right (LTR)  or right to left (RTL) (<code>dir</code> attribute).
 +
* '''Stylesheet Classes''' &ndash; the class of the table element (<code>class</code> attribute). Note that a table element might be assigned more than one class. If this is a case, separate class names with spaces.
 +
* '''Style''' &ndash; CSS style definitions (<code>style</code> attribute). Note that each value must end with a semi-colon and individual properties should be separated with spaces.
 +
 +
== Working With Tables ==
 +
Once inserted into the document, the table can be modified. To edit the table, either double-click it, or open the table context menu by clicking it with the right mouse button or using the ''Menu/Application'' key on your keyboard.
 +
 +
[[Image:CKEditor_table_contextmenu.png|frame|center|The context menu for a table element]]
 +
 +
 +
To delete the whole table and its contents, use the '''Delete Table''' option.
 +
 +
When you choose the '''Table Properties''' option, the dialog window of the same name will appear.  It allows you to change the configuration options that were set when the table was created, except the number of rows and columns which are grayed out.
 +
 +
Additionally the table context menu lets you modify the rows, columns or particular table cells. This method makes it possible to insert new rows, columns or cells in specified locations as well as merge and split cells.
 +
 +
=== Editing Table Rows ===
 +
The table context menu lets you edit table rows. If you hover your mouse over the '''Row''' menu option, further options become available.
 +
 +
[[Image:CKEditor_table_row_contextmenu.png|frame|center|The context menu for a table row element]]
 +
 +
 +
Below is an overview of all '''Row''' context menu option elements:
 +
* '''Insert Row Before''' &ndash; inserts a new row before the one that contains the cursor.
 +
* '''Insert Row After''' &ndash; inserts a new row after the one that contains the cursor.
 +
* '''Delete Rows''' &ndash; deletes a row that contains the cursor.
 +
 +
Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion may be applied to many table rows at once.
 +
 +
=== Editing Table Columns ===
 +
The table context menu lets you edit table columns. If you hover your mouse over the '''Column''' menu option, further options become available.
  
The second bookmarks regards to "Advanced":<br>
+
[[Image:CKEditor_table_column_contextmenu.png|frame|center|The context menu for a table column element]]
[[Image:CKEditor_table_advanced.png]]
 
  
This bookmark allows user to set following option:
 
  
* '''Id''': specifies link's ID.
+
Below is an overview of all '''Column''' context menu option elements:
* '''Language Direction''': sets the language direction from left to right (LTR)or from right to left ( RTL ).
+
* '''Insert Column Before''' &ndash; inserts a new column before the one that contains the cursor.
* '''Style''': defines the style.
+
* '''Insert Column After''' &ndash; inserts a new column after the one that contains the cursor.
* '''Stylesheet Classes''': specifies the name of the CSS class.
+
* '''Delete Columns''' &ndash; deletes a column that contains the cursor.
  
== Working with the table ==
+
Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion may be applied to many table columns at once.
  
User is able to change table’s properties. To modify table user must point mouse on the table and press the right button to display a context menu..<br>
+
=== Editing Table Cells ===
 +
The table context menu lets you edit table cells. If you hover your mouse over the '''Cell''' menu option, further options become available.
  
[[Image:CKEditor_context_table.png]]
+
[[Image:CKEditor_table_cell_contextmenu.png|frame|center|The context menu for a table cell element]]
  
In order to change the tables’ properties "'''Table Properties'''" should be pressed. A popup window appears. Identical to the one which is used for creating the table.
 
  
To delete the table press "'''Delete Table'''".
+
Below is an overview of all '''Cell''' context menu option elements:
 +
* '''Insert Cell Before''' &ndash; inserts a new cell before the one that contains the cursor.
 +
* '''Insert Cell After''' &ndash; inserts a new cell after the one that contains the cursor.
 +
* '''Delete Cells''' &ndash; deletes a cell that contains the cursor.
  
The other three options are Cell, Row and Column. Pointing with mouse cursor on one of them shows a new context menu.
+
* '''Merge Cells''' &ndash; merges multiple cells in one. This option is only available if two or more cells are selected.
 +
* '''Merge Right''' &ndash; merges the selected cell with a cell on its right. The content of both cells becomes joined. This option is only available if no more than one cell is selected.
 +
* '''Merge Down''' &ndash; merges the selected cell with a cell located on its bottom. The content of both cells becomes joined. This option is only available if no more than one cell is selected.
  
=== Cell<br> ===
+
* '''Split Cell Horizontally''' &ndash; splits the selected cell in two, creating a new cell on its right. The content of the cell appears in the original, left cell. This option is only available if no more than one cell is selected.
 +
* '''Split Cell Vertically''' &ndash; splits the selected cell in two, creating a new cell on its bottom. The content of the cell appears in the original, upper cell. This option is only available if no more than one cell is selected.
 +
* '''Cell Properties''' &ndash; opens the '''[[CKEditor_3.x/Users_Guide/Rich Text/Tables#Cell_Properties|Cell Properties]]'''  dialog window that lets you configure cell size, type, color, and content alignment.
  
[[Image:CKEditor_cell_context.png|The cell context menu]]
+
Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion or merging may be applied to many table rows at once.
  
* '''Insert Cell Before''': inserts a new cell before the cell where the cursor was located.<br>
+
==== Cell Properties ====
* '''Insert Cell After''': inserts a new cell after the cell where the cursor was located.
+
Table cells in CKEditor can be further customized, creating a unique look and feel. Various configuration options can be set in the '''Cell Properties''' dialog window that is opened from the table cell context menu.
* '''Delete Cells''': deletes a cell the cursor was by. User may also highlight more cells and delete them.
 
* '''Merge Cells''': merges cells you have highlighted into a one cell.
 
* '''Merge Right''': merges cell where the cursor was located with the right cell.
 
* '''Merge Down''': merges cell where the cursor was located with cell below. 
 
* '''Split Cell Horizontally''': splits a cell in two. One cell is split into two columns.<br>
 
* '''Split Cell Vertically''': splits a cell in two. One cell is split into two rows.
 
* '''Cell properties''': Clicking the cell properties displays a new popup window called "Cell Properties". :
 
  
<br>
+
[[Image:CKEditor_table_cell_properties.png|frame|center|The Cell Properties dialog window in CKEditor]]
  
[[Image:CKEditor_cell_properties.png]]<br>
 
  
* '''Width''': sets the cell width in pixels or in percentage of the table width.
+
Below is an overview of all '''Cell Properties''' dialog window elements:
* '''Height''': sets the height of the cell. <br>
+
* '''Width''' &ndash; the width of the cell in pixels or a percent value. Giving the width as a percent value lets you set the proportion of the row that the cell (and the column it is located in) will occupy.
* '''Word Wrap''': turns on/off word wrapping.
+
* '''Height''' &ndash; the height of the cell in pixels.
* '''Horizontal Alignment''':determines the horizontal alignment of the text in a cell. Three options are available: Left, Center and Right.
 
* '''Vertical Alignment''': determines the vertical alignment of the text in a cell, which may be set to Top, Middle, Bottom or Baseline.
 
* '''Cell Type''': determines the type of cell, user may set Data cell or Header cell.
 
* '''Rows span''': extends vertical rows.
 
* '''Columns span''':extends cells on a horizontal row (left and right).
 
* '''Background color''': sets the background color of a cell. User may either select a color or type it manually.
 
* '''Border Color''': sets the color of your cells border. User may either select a color or type it manually.
 
  
=== Row<br> ===
+
* '''Cell Type''' &ndash; the type of the table cell &mdash; either a normal data cell or a header cell  with special formatting.
  
[[Image:CKEditor_row_context.png]]
+
* '''Word Wrap''' &ndash; this setting turns word wrapping of the cell content on and off.
  
* '''Insert Row Before''': inserts a new row before the row where the cursor was located.
+
* '''Rows Span''' &ndash; this setting stretches the cell downward over several rows. Entering a numeric value sets the <code>rowspan</code> attribute.
* '''Insert Row After''': inserts a new row after the row where the cursor was located.
+
* '''Columns Span''' &ndash; this setting stretches the cell to the right over several columns. Entering a numeric value sets the <code>colspan</code> attribute.
* '''Delete Rows''': deletes highlighted rows or the row the cursor was by.
 
  
=== Column ===
+
* '''Horizontal Alignment''' &ndash; the horizontal alignment of table cell contents. The following options are available: '''Left''', '''Center''', '''Right'''.
 +
* '''Vertical Alignment''' &ndash; the vertical alignment of table cell contents. The following options are available: '''Top''', '''Middle''', '''Bottom''' or '''Baseline'''.
  
[[Image:Column context.png|Image:Column_context.png]]<br>
+
* '''Background Color''' &ndash; the color of the cell background. You can use either of the following methods to set the color:
 +
** Enter the [http://en.wikipedia.org/wiki/RGB_color_model RGB] value in the text box, in the <code>rgb(''nn'', ''nn'', ''nn'')</code> format, where <code>''nn''</code> is a numeric value on a scale from 0 to 255 representing the red, green, and blue channel.
 +
** Enter the hexadecimal RGB value in the text box, in the <code>#''nnnnnn''</code> format, where the <code>''n''</code> letters stand for the three pairs of hex color values representing the red, green, and blue channel.
 +
** Use the '''Choose''' button to open the '''Select color''' dialog window and pick the color with your mouse.
 +
* '''Border Color''' &ndash; the color of the cell border. You can use either of the following methods to set the color:
 +
** Enter the RGB value in the text box, in the <code>rgb(''nn'', ''nn'', ''nn'')</code> format, where <code>''nn''</code> is a numeric value on a scale from 0 to 255 representing the red, green, and blue channel.
 +
** Enter the hexadecimal RGB value in the text box, in the <code>#''nnnnnn''</code> format, where the <code>''n''</code> letters stand for the three pairs of hex color values representing the red, green, and blue channel.
 +
** Use the '''Choose''' button to open the '''Select color''' dialog window and pick the color with your mouse.
  
* '''Insert Column Before''': inserts a column before the column your cursor is currently in.
+
[[Image:CKEditor_select_color.png|frame|center|The Select Color dialog window in CKEditor used for setting the cell background and border color]]
* '''Insert Column After''': inserts a column after the column your cursor is currently in.
 
* '''Delete Columns''': deletes highlighted columns or the column your cursor is currently in.<br>
 

Latest revision as of 14:07, 27 June 2011

A table is a perfect format for some types of data, including statistical information. CKEditor not only lets you add and edit this document element in a quick and easy way but also offers advanced customization options.

Creating a Table

To create a table in CKEditor, press the Table‎ button on the toolbar. The Table Properties dialog window that will open lets you set configuration options that define table size, its display properties, or other advanced properties.

The Table Properties dialog window includes two tabs that group table options:

For general information on using dialog windows please refer to the Dialog Windows section of the User's Guide.

Table Properties

The Table Properties tab is the default tab that opens after you press the Table button on the toolbar. It allows you to set the table dimensions and configure the way it will appear in the document.

Table Properties dialog window with the default tab open


Below is an overview of all Table Properties tab elements:

  • Rows – the number of rows in the table (obligatory).
  • Columns – the number of columns in the table (obligatory).
  • Width – the width of the table in pixels or a percent value. Giving the width as a percent value lets you set the proportion of the editing area that the table will occupy.
  • Height – the height of the table in pixels.
  • Headers – the drop-down list that formats certain table cells as headers, which applies special formatting to them. You can apply header formatting to First Row, First Column or Both.
  • Border size – the thickness of the table border in pixels.
  • Alignment – the alignment of the table on the page. The following options are available: Left, Center, Right.
  • Cell spacing – the space between individual cells as well as cells and table borders, in pixels.
  • Cell padding – the space between the cell border and its contents, in pixels.
  • Caption – the label of the table that is displayed on top of it.
  • Summary – the summary of the table contents that is available for assistive devices like screen readers. It is a good practice to provide your tables with meaningful summary text in order to make it more accessible to users with disabilities.

Advanced

The Advanced tab lets you configure additional image options such as assign it an ID, a class, a language direction, or CSS style properties. It is meant for advanced users with knowledge of HTML as well as CSS, and gives nearly endless possibilities as far as the presentation of the table is concerned.

Advanced tab of the Table Properties window


Below is an overview of all Advanced tab elements:

  • Id – a unique identifier for a table element in the document (id attribute).
  • Language Direction – the direction of the text in the table: left to right (LTR) or right to left (RTL) (dir attribute).
  • Stylesheet Classes – the class of the table element (class attribute). Note that a table element might be assigned more than one class. If this is a case, separate class names with spaces.
  • Style – CSS style definitions (style attribute). Note that each value must end with a semi-colon and individual properties should be separated with spaces.

Working With Tables

Once inserted into the document, the table can be modified. To edit the table, either double-click it, or open the table context menu by clicking it with the right mouse button or using the Menu/Application key on your keyboard.

The context menu for a table element


To delete the whole table and its contents, use the Delete Table option.

When you choose the Table Properties option, the dialog window of the same name will appear. It allows you to change the configuration options that were set when the table was created, except the number of rows and columns which are grayed out.

Additionally the table context menu lets you modify the rows, columns or particular table cells. This method makes it possible to insert new rows, columns or cells in specified locations as well as merge and split cells.

Editing Table Rows

The table context menu lets you edit table rows. If you hover your mouse over the Row menu option, further options become available.

The context menu for a table row element


Below is an overview of all Row context menu option elements:

  • Insert Row Before – inserts a new row before the one that contains the cursor.
  • Insert Row After – inserts a new row after the one that contains the cursor.
  • Delete Rows – deletes a row that contains the cursor.

Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion may be applied to many table rows at once.

Editing Table Columns

The table context menu lets you edit table columns. If you hover your mouse over the Column menu option, further options become available.

The context menu for a table column element


Below is an overview of all Column context menu option elements:

  • Insert Column Before – inserts a new column before the one that contains the cursor.
  • Insert Column After – inserts a new column after the one that contains the cursor.
  • Delete Columns – deletes a column that contains the cursor.

Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion may be applied to many table columns at once.

Editing Table Cells

The table context menu lets you edit table cells. If you hover your mouse over the Cell menu option, further options become available.

The context menu for a table cell element


Below is an overview of all Cell context menu option elements:

  • Insert Cell Before – inserts a new cell before the one that contains the cursor.
  • Insert Cell After – inserts a new cell after the one that contains the cursor.
  • Delete Cells – deletes a cell that contains the cursor.
  • Merge Cells – merges multiple cells in one. This option is only available if two or more cells are selected.
  • Merge Right – merges the selected cell with a cell on its right. The content of both cells becomes joined. This option is only available if no more than one cell is selected.
  • Merge Down – merges the selected cell with a cell located on its bottom. The content of both cells becomes joined. This option is only available if no more than one cell is selected.
  • Split Cell Horizontally – splits the selected cell in two, creating a new cell on its right. The content of the cell appears in the original, left cell. This option is only available if no more than one cell is selected.
  • Split Cell Vertically – splits the selected cell in two, creating a new cell on its bottom. The content of the cell appears in the original, upper cell. This option is only available if no more than one cell is selected.
  • Cell Properties – opens the Cell Properties dialog window that lets you configure cell size, type, color, and content alignment.

Note that CKEditor makes it possible to select multiple table cells by dragging the mouse over them, so an operation like deletion or merging may be applied to many table rows at once.

Cell Properties

Table cells in CKEditor can be further customized, creating a unique look and feel. Various configuration options can be set in the Cell Properties dialog window that is opened from the table cell context menu.

The Cell Properties dialog window in CKEditor


Below is an overview of all Cell Properties dialog window elements:

  • Width – the width of the cell in pixels or a percent value. Giving the width as a percent value lets you set the proportion of the row that the cell (and the column it is located in) will occupy.
  • Height – the height of the cell in pixels.
  • Cell Type – the type of the table cell — either a normal data cell or a header cell with special formatting.
  • Word Wrap – this setting turns word wrapping of the cell content on and off.
  • Rows Span – this setting stretches the cell downward over several rows. Entering a numeric value sets the rowspan attribute.
  • Columns Span – this setting stretches the cell to the right over several columns. Entering a numeric value sets the colspan attribute.
  • Horizontal Alignment – the horizontal alignment of table cell contents. The following options are available: Left, Center, Right.
  • Vertical Alignment – the vertical alignment of table cell contents. The following options are available: Top, Middle, Bottom or Baseline.
  • Background Color – the color of the cell background. You can use either of the following methods to set the color:
    • Enter the RGB value in the text box, in the rgb(nn, nn, nn) format, where nn is a numeric value on a scale from 0 to 255 representing the red, green, and blue channel.
    • Enter the hexadecimal RGB value in the text box, in the #nnnnnn format, where the n letters stand for the three pairs of hex color values representing the red, green, and blue channel.
    • Use the Choose button to open the Select color dialog window and pick the color with your mouse.
  • Border Color – the color of the cell border. You can use either of the following methods to set the color:
    • Enter the RGB value in the text box, in the rgb(nn, nn, nn) format, where nn is a numeric value on a scale from 0 to 255 representing the red, green, and blue channel.
    • Enter the hexadecimal RGB value in the text box, in the #nnnnnn format, where the n letters stand for the three pairs of hex color values representing the red, green, and blue channel.
    • Use the Choose button to open the Select color dialog window and pick the color with your mouse.
The Select Color dialog window in CKEditor used for setting the cell background and border color
This page was last edited on 27 June 2011, at 14:07.