Line Numbering in Tables

J

Journey51

Is line numbering in tables possible? My boss is wanting this done, but as
far as I know Word does not line number tables.

Thank you!!
Cheryl
 
T

Tom Conrad

I have found two methods.
For both alternatives, the line numbers are not associated with the lines of
the table they are associated with blank paragraphs wrapped around the table
or wrapped around the text box.

1. Place the table within a text box.
Set the "Wrapping Style" property of the text box, to in front of text.

Caution, with these properties it is possible to have text appear behind the
text box.
If the fill color of the text box is set to white it could create hidden text.

Additonally, if the table font is smaller than the document's normal or body
text then the line numbers will not align properly. It is also possible to
insert text into the text box that is external to the table.

2. You can also get line numbering for tables if the table is center or
right aligned.
The table's text wrapping property is set to around, and the table alignment
is set to right or center. You will have to set a preferred witdth for the
table.
If the table exceeds a certain width the line numbering will shift below the
table.
As in the text box solution, the line numbers are roughly accurate, only so
long as the table font is the same size as the document's normal of body font.
 
J

Journey51

Thank you, Tom! I'll try both of those methods.

Tom Conrad said:
I have found two methods.
For both alternatives, the line numbers are not associated with the lines of
the table they are associated with blank paragraphs wrapped around the table
or wrapped around the text box.

1. Place the table within a text box.
Set the "Wrapping Style" property of the text box, to in front of text.

Caution, with these properties it is possible to have text appear behind the
text box.
If the fill color of the text box is set to white it could create hidden text.

Additonally, if the table font is smaller than the document's normal or body
text then the line numbers will not align properly. It is also possible to
insert text into the text box that is external to the table.

2. You can also get line numbering for tables if the table is center or
right aligned.
The table's text wrapping property is set to around, and the table alignment
is set to right or center. You will have to set a preferred witdth for the
table.
If the table exceeds a certain width the line numbering will shift below the
table.
As in the text box solution, the line numbers are roughly accurate, only so
long as the table font is the same size as the document's normal of body font.
 
D

David Sisson

If you're not opposed to adding a column, this macro will add the column and
auto-number or letter the table.

Sub LineNumberingTables()
'2007 David Sisson
'Adds a column for the numbering.

Dim aDoc As Document
Dim aTable As Table
Dim ThisRow As Table
Dim NumRows As Integer
Dim A As Integer
Dim ASCIICode As Integer

'The Computer number for the letters
ASCIICode = 96 'One less than lower case a
'ASCIICode = 64 'One less than upper case A

Set aDoc = ActiveDocument
Set aTable = aDoc.Tables(1)

For Each ThisRow In aDoc.Tables

ThisRow.Columns.Add BeforeColumn:=ThisRow.Columns(1)
NumRows = ThisRow.Rows.Count

For A = 1 To NumRows
'Uses letters. For rows less than 26.
'ThisRow.Cell(A, 1).Range.Text = Chr(ASCIICode + A) + "."
'Uses numbers. e.g. .1, .2, etc
ThisRow.Cell(A, 1).Range.Text = "." & A
Next

ThisRow.Columns(1).AutoFit
'Turns off the borders.
ThisRow.Columns(1).Borders(wdBorderLeft) = False
ThisRow.Columns(1).Borders(wdBorderBottom) = False
ThisRow.Columns(1).Borders(wdBorderTop) = False
ThisRow.Columns(1).Borders(wdBorderHorizontal) = False

Next
End Sub
 
S

SueT

If you are using a unique paragraph style for the first column in the table,
you could simply define that style be numbered. Don't forget to reset the
numbering in the first row of each table - assuming that you don't want it to
continue from one table to the next.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top