Line Numbering

Home Up Odds & Ends Photo Gallery Search Contact Me Privacy Notice What's New?

 

 

The information in this website is provided without risk or obligation and free of charge.  However, if you have benefitted from my efforts here and would like to make a contribution to help me continue and maintain this work then any donation will be greatly appreciated. Please click the adjacent button to access PayPal.  Thank you.
 
This Microsoft Word Tips & Microsoft Word Help provides some examples and discussion on using Word's Line Numbering feature.  This page is born of a brief détente between two bitter foes (a separate story) and the fruits of a quest to display line numbers in the right hand margin like in the text sample shown below.

 :old: Note:  Steps, illustrations and descriptions in this tips page are applicable to a standard U.S. English installation of  Word2007 and Windows XP.   

With the exception of a few suggestions for mimicking line numbering by anchoring a textbox containing appropriate numbers in the header, a Google search came up empty and returned nothing to suggest how this could be achieved using Word's line numbering feature.
The solution requires a bit of Word trickery.  The the "key" is enabling a right to left script language such as Hebrew or Arabic.

To enable a right to left script language (e.g., Hebrew), perform the following steps:

- Close Word
- Click "Start" > "All Programs"
- Click "Microsoft Office" > "Microsoft Office Tools" > "Microsoft Office 2007 Language Settings"
- Select "Hebrew" in the "Available editing languages" field
- Click "Add" then click "Ok"
- Open Word

When a right to left script language is enabled the Word user interface (UI) reflects (at least) two changes.

A pair of controls are added to the Home>Paragraph group that are used to set text direction.

A "Section direction" option is added to the Page Setup>Layout dialog.

In the example shown above the text is separated by a continuous section break into two sections.  I displayed non-printing characters and an empty paragraph to clearly show the section break.

In Section 1, the quotation  (or the portion in italics), the lines are numbered.  The text is "right aligned, left to right text," with the section direction set to "Right to left."  However, it is the section direction setting that determines line number placement. These settings are shown in the following dialogs:

:old: Clicking "Line Numbers..." on the Page Setup>Layout tab dialog displays Line Numbers dialog. 

In Section 2, the credit lines (or the portion in roman text), line numbering is not enabled as shown in the following dialog:

The follow illustrates several examples of left to right and right to left script text with line numbering displayed.  I included non-printing characters so you will see the section breaks."

:dunno Forgive the dearth of inspirational text.  This is the only short example I could find with an English translation.

The first example is English left to right script, left aligned, with the section direction set left to right.

The second example is English left to right script, right aligned, with the section direction set left to right.

The third  is English left to right script, left aligned, with section direction set right to left.

The fourth example is Arabic right to left script, right aligned, with section direction set right to left.

The last example is Hebrew right to left script, right aligned, with section direction set left to right.

These examples clearly show that it is section alignment that determines in which margin line numbers are displayed.  The display is not dependent on or affected by either text alignment or text direction.

Remember though, it is not section alignment alone.  For line numbers to appear in the right margin you must set the section alignment to right to left "and" have a right to left script language enabled.  This can be demonstrated using VBA in the following manner. 

  - Close Word
  - Click "Start" > "All Programs"
  - Click "Microsoft Office" > "Microsoft Office Tools" > "Microsoft Office 2007 Language Settings"
  - Select "Hebrew" in the "Enabled editing languages" field
  - Click "Remove" then click "Ok"
  - Open and new Word document and open the Page Setup dialog.  The "Section direction" option is no longer available.

  - Enter a few lines of text

  - Open the VB Editor (VBE) and paste in and execute the following code:
  Sub Demo1()
With ActiveDocument.Sections(1).PageSetup
  .SectionDirection = wdSectionDirectionLtr
  With .LineNumbering
    .Active = True
  End With
End With
End Sub
  - Line numbering appears in the left margin.

- Now change the section direction to right to left using using the following line in the VBE Immediate window:
  ActiveDocument.Sections(1).PageSetup.SectionDirection = wdSectionDirectionRtr
- The line numbering is gone (trust me)!!
- Now enable a right to left script language using the steps provided earlier.  Be sure save your document and close Word.
- Open Word and your document.  Bingo!!

See: Installing Macros for instructions on how to set up and use the macro listed above.

:old: Remember.  The "key" to line numbering in the right margin is a right to left script language enabled.  With this key and proper section direction you can display line numbering in the left or right margins.  


Looking for something else?

Google
 

Ask an MS Word Expert Online

Ask a Question, Get an Answer ASAP.

JustAnswer