Line Numbering in Tables

Line Numbering in Tables

Post by Sm91cm5leT » Tue, 17 Jul 2007 05:48:00


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
 
 
 

Line Numbering in Tables

Post by VG9tIENvbn » Tue, 17 Jul 2007 08:18:03

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.

--
Tom Conrad

 
 
 

Line Numbering in Tables

Post by Sm91cm5leT » Tue, 17 Jul 2007 08:54:00

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

Line Numbering in Tables

Post by RGF2aWQgU2 » Sat, 21 Jul 2007 00:22:07

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
 
 
 

Line Numbering in Tables

Post by U3VlV » Mon, 13 Aug 2007 08:14:02

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.
--
SueT