Inserting Tables Using the Keyboard


This post describes a little trick that lets you insert a table into RichEdit and into Word just using the keyboard. Admittedly in Word, you can use the handy table tool on the Insert tab with a mouse or with a keyboard. But in WordPad and the Windows RT RichEditBox, you don’t have a table tool.

So here’s the trick: on a line of its own type a plus (+) followed by as many dashes (-) as needed for the width of the first cell, followed by a plus to end that cell. If you only want a one column table, just hit the Enter key and you have a one cell table. To have more cells in the row, type more dashes and pluses, being sure to end the line with a plus. For example, hitting the Enter key at the end of the line

+———————–+———+————————————-+

inserts the table row

 

 

 

When you have as many cells as you want, to get another row, put the insertion point at the end of the row and hit the Enter key. Alternatively put the insertion point in the last cell and hit the Tab key. If the insertion point isn’t in the last cell of the table, a Tab advances to the next cell and a Shift+Tab backs up to the previous cell. When the insertion point is in the last cell of a table, the Tab key inserts another row. So pretty quickly you can enter a simple table with arbitrary numbers of cells, rows, and cell sizes. You can use the mouse to change the width of the columns.

You can also change the alignment of a table by selecting the whole table including the end of row marks and hitting ctrl+e or ctrl+r for centering and right-justifying the table, respectively. Ctrl+L left justifies the table. In Word there are a number of other cool tools such as the one to autofit the contents of a table (select the table, right-mouse click on it and choose the Autofit option).


Comments (6)

  1. Nali says:

    Cool trick!! It is also possible to replace the dashes with blank spaces.

    Are there also some another hidden features in MS-Word that make possible to use keybord instead of mouse?

  2. MurrayS3 says:

    I didn't know that spaces would work in Word too. So I added it to my copy of RichEdit 🙂 Dashes are easy enough to type, but spaces are even easier.

    You can access most of Word's functionality using the keyboard alone. This may be related to accessibility requirements. Two ways to discover keyboard shortcuts: First, type the left alt key. The ribbon tabs light up with the keys to activate them. Typing one of these keys, that tab is activated and the keys to activate the various options appear, etc. So you can drive the ribbon with the keyboard. Second, to see lots of other hot keys, type alt+f and choose Word Options/Customize Ribbon/Keyboard shortcuts and select the category "All commands". Then you can press the down arrow key to scan through the commands and see which ones have hot keys. If there's a command that you want to have a hot key but doesn't, you can assign one to your liking.

    Also you can look at the keyboard shortcut list support.microsoft.com/…/290938

  3. MurrayS3 says:

    In Word, you can also type

    =rand(3,2)<enter>

    This inserts three paragraphs, each containing two sentences. This is a quick way to insert some text to play around with. Adjust the numbers to get more or less text.

  4. txt says:

    Are these Office-2010-only features? I wasn't able to do it in Office 2007 or in WordPad.

  5. MurrayS3 says:

    The table feature was added in RichEdit 6.0 and Windows 7 has RichEdit 4.1. Windows 8 has a version of RichEdit 8. The table feature does work in all versions of Word that you can find, e.g., all the way back to Word 97. The =rand(n,m) feature is Word only. Maybe RichEdit should have it too…

  6. Rupali says:

    Khup chan………very nice……………..hats off to those who invented this trick…………….lots n lots of thanks…