6 Handy Tips to Add Line Numbers and Set Their Formatting in Your Word Document

The coming article shall show you 6 handy tips to add line numbers and set their formatting in your Word document.

In word, you can add line numbers to document. Line numbers number each line on your document in order which enable you to have a quick idea of which line you are. Now line numbers are like any other normal texts and they have a style, based on default paragraph font. Besides, there are other formatting involving its distance to texts and text direction, which happen to be our topic today.Add Line Numbers and Set Their Formatting

Tip 1: Add Line Numbers

  1. Firstly, click “Page Layout” tab.
  2. Then click “Line Numbers” command to open its drop-down menu.
  3. Choose an option available, such as “Restart Each Page”. Then each page shall start at “1”.Click "Page Layout"->Click "Line Numbers"->Choose an Option
  4. Or you can click “Line Numbering Options” to open “Page Setup” dialog box.
  5. Click “Line Numbers” button to open “Line Numbers” dialog box.
  6. Then check “Add line numbering” box and set configurations there.
  7. Lastly, click “OK” in both 2 boxes.Click "Line Numbers"->Check "Add line numbering" Box->Set Configurations->Click "OK" in Both Boxes

Tips 2: Modify “Line Number” Style

By default, line numbers take the default paragraph font style. When you change the text style, the one of those line numbers stay intact. There is no direct way to change style of those line numbers. But you can do it by altering style.

  1. Press “Alt+ Ctrl+ Shift+ S” to open “Styles” window.
  2. Find “Line Number” style and right click on it.
  3. Choose “Modify” to open “Modify Style” box.Right click on Style Name->Choose "Modify"
  4. Set the formatting there and click “OK”.Set Formatting->Click "OK"

You can view the effect such as bellow:Change of Line Number Style

Tip 3: Alter “Normal” Style to Change the Style of Line Numbers

As mentioned above, line numbers are in default paragraph style. Therefore, if you want to format line numbers to match your document texts, don’t change the document texts with options in the Ribbon. Instead, go to modify the “Normal” style. You will then find line number style change as well.

  1. Use the same shortcut in tip 1 to open “Styles” window.
  2. Find and right click on “Normal” style.
  3. The repeat step 3 and 4 in tip 1 as well.

Nevertheless, there is a setback. The font type and size of line numbers stay the same as default. But its color will change to the same as that of the document texts.Change of the Line Number Color

Tip 4: Run Word Macro to Change Line Number Style

  1. Firstly, press “Alt+ F11” to trigger VBA editor.
  2. Then click “Normal” project and then “Insert” tab.
  3. Choose “Module” on the menu.Click "Normal"->Click "Insert"->Click "Module"
  4. Next double click to open the new module and paste the macro there:
Sub AlterLineNumberStyle()
  Dim objDoc As Document
  Set objDoc = ActiveDocument
  With objDoc.Styles("Line Number").Font
    .Name = "Arial"
    .Size = 12
    .ColorIndex = wdBlue
  End With
End Sub
  1. Lastly, click “Run”.Paste Macro->Click "Run"

This macro sets line numbers in “Arial” font at 12 pt with blue color. You can change these constants as required.Effect of Running Macro

Tip 5: Put Line Numbers in the Right Margin of Documents Texts

  1. First of all, click “Start” then “All Programs”.
  2. Secondly, find and click “Microsoft Office”.
  3. Thirdly, click “Microsoft Office 2010 Tools”.
  4. Next click “Microsoft Office 2010 Language Preferences” to open the same bane dialog box.Click "Microsoft Office 2010 Tools"->Click "Microsoft Office 2010 Language Preferences"
  5. Go to click the drop-down button on “Add additional editing languages” field under “Choose Editing Languages”.
  6. Choose “Hebrew”.
  7. Then click “Add” and “OK”.Choose "Hebrew"->Click "Add"->Click "OK"
  8. Next click “OK” for the warning message prompting up. Save your work and restart Word.Click "OK"
  9. Now click the little arrow button at the right-down bottom in “Page Setup” group under “Page Layout” tab.
  10. In the “Page Setup” dialog box, ensure “Layout” tab is on. Choose “Right-to-Left” in “Section direction” field.
  11. Then click “Line Numbers” button and follow instructions in tip 1 to set line number options and click “OK” to save the change.Choose "Right-to-Left" for "Section direction" Field->Click "Line Numbers" Button->Set Formatting->Click "OK"

Check the outcome as bellow:Line Numbers in Right Margin

Tip 6: Change the Distance between Line Number and Document Text

Still, we can’t change the distance between line number and text directly with built-in command in Word. Thus we will take the macro way.

Use the same steps in tip 4 to install and run a macro. This time use the bellowing codes instead:

Sub ChangeLineNumberDistanceFromText()
  Dim objDoc As Document
  Set objDoc = ActiveDocument
  With objDoc.PageSetup.LineNumbering
    .Active = True
    .DistanceFromText = 30
  End With
End Sub

View the effect:Enlarge Distance

What to Do in Face of Corrupt Documents

If your Word stops working out of no reason, check your documents immediately. There is a large chance that they may get corrupted. Then you are in need of an eligible tool to recover docx as soon as possible.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Excel and pdf repair software products. For more information visit www.datanumen.com