none
Line numbers in tables RRS feed

  • Question

  • The standard line numbering in Word does not include tables. But to be able te refer to table rows as well as to the other lines in a document, I need the tables to be numbered as well.

    Does anyone have a solution to add line numbers to tables?

    As far as I am concerned, the table could also be numbered as sub-numbers to the line number on whihch the complete table is numbered (eg when I have a table, inserted on line 10 in the document, the line nrs for the table could be 10-1, 10-2 etc, or 10a, 10b et.)

    Friday, April 24, 2015 1:05 PM

Answers

  • If you make use of fixed line spacing for all text (inside and outside of tables), you can fake line numbers by typing them into a text box. Anchor the text box to the page header and drag it into position in the left margin. This is a relatively time-consuming task, and what you are doing right now is probably more convenient!


    Stefan Blom, Microsoft Word MVP

    Wednesday, April 29, 2015 12:34 PM
  • You'd have to calculate the numbers using a formula field somehow. Perhaps it would be possible to make use of the PAGE field (which, naturally, increments by 1 for each new page).

    Stefan Blom, Microsoft Word MVP

    Friday, May 1, 2015 12:19 AM

All replies

  • be a little afraid there is a way coulg get the line number for a table in word. What I have known ,line number is only for text.
    Wednesday, April 29, 2015 4:54 AM
  • Yes, you are right. a table is placed on just one line, so the line number for the table is all the same.

    For now, I use the work-around to add line numbers to the document and to put in numbers for each cell in each table (select the whole table and use the numbering button in the paragraph section on the home tab, add the line number in front of the numbers). I am still working on a possibility to add the line number in front of that number by a macro, so that I can do everything in just one mouse click.

    Wednesday, April 29, 2015 5:58 AM
  • If you make use of fixed line spacing for all text (inside and outside of tables), you can fake line numbers by typing them into a text box. Anchor the text box to the page header and drag it into position in the left margin. This is a relatively time-consuming task, and what you are doing right now is probably more convenient!


    Stefan Blom, Microsoft Word MVP

    Wednesday, April 29, 2015 12:34 PM
  • Thank you Stefan, but I am not quite sure how this can create line numbers in the whole document. If I have to drag all textboxes in a document with more then 300 pages, this will take a lot of time.

    Probably, this can be done by a macro, do you have some sample code to do this?

    I also tried to find how to use the line number, since each table is linked to just one line number, it would be possible to select all tables and use the standard Word numbering function, where I add the line number in front of the numbering.

    But with .Information(wdFirstCharacterLineNumber) or with

    .ComputeStatistics(wdStatisticLines), I don't get the same line numbers as the ones Word generates automatically.

    Wednesday, April 29, 2015 12:47 PM
  • As I wrote, you should anchor the text box to the page header. That way, it will repeat on all pages using that header.

    But getting the numbers to align with text lines may be difficult.


    Stefan Blom, Microsoft Word MVP

    Wednesday, April 29, 2015 12:59 PM
  • Sorry, you are right, I reacted too fast. Thanks again.
    Wednesday, April 29, 2015 1:42 PM
  • Now, I did put a textbox in the header, and I get a numbering that can be aligned with the lines in the document, but the numbering starts at 1 again on every page. Is there a possibility to have the numbering go on continuously over the complete document?

    Thursday, April 30, 2015 5:56 AM
  • You'd have to calculate the numbers using a formula field somehow. Perhaps it would be possible to make use of the PAGE field (which, naturally, increments by 1 for each new page).

    Stefan Blom, Microsoft Word MVP

    Friday, May 1, 2015 12:19 AM
  • I already found another option, not as good as line numbers, but for us, just using the line numbers as a way to indicate where a change has to be made, it is acceptable.

    I use the line numbers for all "normal" text. With a line number, a table can be indicated, since each table is on just one single line in the text. I then use a macro to walk through all tables, adding a column in front of the table. If you keep this column as narrow as possible, the table will remain unchanged, it will only shift a bit into the right margin.

    In this additional column, I put the rowwnumber as a number. I created a second macro to remove these columns again and included the command to switch the normal linenumbering on and off.

    I added both macros to the ribbon. It is quite a work-around, but it works for us.

    Tuesday, May 12, 2015 5:34 AM
  • Thanks for the follow-up!


    Stefan Blom, Microsoft Word MVP

    Tuesday, May 12, 2015 7:39 AM