Need help numbering lines

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I am using Word 2003.

I'm writing a documentation from a program and I need to cite some program
code - you know, those lengthly stuff. I have to number the lines for easier
reference.

I created a table of one row and two columns and reduce the width of the
left column. The line numbers are put in the left column and the program code
is put in the right column.

I used to type the line numbers one by one. But now I have come across a
program with ten-thousand lines. Is there a smarter way of numbering the
lines?

Thanks.
 
Hello, I am using Word 2003.

I'm writing a documentation from a program and I need to cite some program
code - you know, those lengthly stuff. I have to number the lines for easier
reference.

I created a table of one row and two columns and reduce the width of the
left column. The line numbers are put in the left column and the program code
is put in the right column.

I used to type the line numbers one by one. But now I have come across a
program with ten-thousand lines. Is there a smarter way of numbering the
lines?

Thanks.

Yes, look in the help for the topic about the SEQ field. You can
insert one in the first cell, copy it, select the whole column, and
paste. Then, while they're still all selected, press F9 to update the
fields.

Be aware that Word has difficulty with extremely long tables (see
http://www.word.mvps.org/FAQs/TblsFldsFms/FastTables.htm). You may
need to break the table every 5 pages or so. This won't affect the SEQ
fields.
 
If you followed the instruction in that help topic about using the Caption
command, that's not what I meant. You can't use that command for your
purpose. Instead, you must use the Insert > Field command to make the first
SEQ field, and copy/paste to make more.

As I reread your original post, I think I misunderstood. Does your table
have only one row containing all the lines, or do you have each line in a
separate row? If it's only one row, then:
- insert the first SEQ field at the beginning of the first cell
- press Enter
- copy the SEQ field and the paragraph mark
- move down to the next line
- paste
- repeat the move-and-paste as needed
- select all the SEQ fields and press F9

If you have hundreds of lines to number, you can speed up the copy/paste a
lot: After the first paste, copy both lines and paste; then copy the four
lines and paste, then copy eight lines, etc.
 
That's handy!
Thanks very much, Jay!

Xero
Jay Freedman said:
If you followed the instruction in that help topic about using the Caption
command, that's not what I meant. You can't use that command for your
purpose. Instead, you must use the Insert > Field command to make the first
SEQ field, and copy/paste to make more.

As I reread your original post, I think I misunderstood. Does your table
have only one row containing all the lines, or do you have each line in a
separate row? If it's only one row, then:
- insert the first SEQ field at the beginning of the first cell
- press Enter
- copy the SEQ field and the paragraph mark
- move down to the next line
- paste
- repeat the move-and-paste as needed
- select all the SEQ fields and press F9

If you have hundreds of lines to number, you can speed up the copy/paste a
lot: After the first paste, copy both lines and paste; then copy the four
lines and paste, then copy eight lines, etc.
 
Another approach, if each line of code is in a separate row, is to create a
separate column for the numbers and then just click on the Numbering button
to insert numbering. You may need to fine-tune the number formatting, but
this is a quick-and-dirty way to accomplish what you need.

Also, be aware that if line numbers are all you need (as opposed to
"instruction" numbers), you can apply line numbering to ordinary text (but
not text in a table) using the command on the Layout tab of Page Setup.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Back
Top