Share via

Horizontal line with centered text

Anonymous
2012-03-12T02:00:12+00:00

One can set a tab with a leader, such as dashes or periods, and what I'm trying to do is similar.

I've got a resume here I'm trying to emulate. For each major section, there's a section name centered on the page, but with a horizontal line extending from the beginning (and end) of that text to the left (and right) margins. That's what I'm trying to do.

I suppose I could draw a margin-to-margin horizontal line, then put an opaque text box in front of it. I usually have trouble with keeping these objects where they belong, though, so I was hoping there might be a slicker solution.

In the resume I'm looking at (it's a .pdf) the horizontal line isn't centered vertically on the text, but rather is at the top of the text--this would be acceptable, too.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Suzanne S Barnhill 277.2K Reputation points MVP Volunteer Moderator
    2012-03-12T04:09:45+00:00

    You really got my hopes of with your reference to a "center-line leader," but in fact this is the same old leader as in previous versions, created with hyphens. This will not produce the solid line that is wanted UNLESS, after inserting the tabs, you select just the tab character and condense the spacing (on the Advanced tab of the Font dialog) until it becomes solid.

    Another approach is to use the underline leader and format it as Raised, but both require additional formatting, so it's six of one and half a dozen of the other.

    3 people found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-08-04T21:28:03+00:00
    1. Format your text as left-alligned and no indents.
    2. Format tabs for the paragraph, one is a left tab, one is a center tab, one is a right tab
    3. With your cursor at the beginning of the line format for strike-through and then press tab
    4. Now have no strike-through and type your text
    5. Now set strike-through and press tab
    6. Adjust the positions of the tab stops so that your text is in the right position and the horizontal lines end where you want
    9 people found this answer helpful.
    0 comments No comments
  2. Jay Freedman 207.6K Reputation points Volunteer Moderator
    2012-03-12T02:50:29+00:00

    Put the cursor in the paragraph that contains the section name. Right-click and choose Paragraph. At the bottom of the dialog, click the Tabs button.

    If the Tab Stop Position list contains any entries, click the Clear All button.

    In the box at the top of the Tab Stop Position list, type the position of the center of the text column. For example, if you use US Letter page size (8.5 inches wide) and have 1" margins, the text column is 6.5" wide, so the center is 3.25". Type in 3.25. Click the Center alignment and the center-line (3) leader. Important: Click the Set button, NOT the OK button.

    Now type the position of the right margin (6.5 in the example above), click the Right alignment, and again click the center-line leader. Click the Set button, NOT the OK button.

    Once the Tab Stop Position list contains both 3.25 and 6.5, now you can click the OK button.

    At the left end of the line containing the section name, press the Tab key to create the line on the left. Then go to the right end of the section name and press the Tab key again to create the line on the right.

    4 people found this answer helpful.
    0 comments No comments
  3. Jay Freedman 207.6K Reputation points Volunteer Moderator
    2012-03-12T16:09:50+00:00

    Sorry to have misled you. I just set the font size of the tabs a bit smaller, and the gaps between hyphens disappeared. Condensed spacing would do as well, but that dialog page is a bit harder to get to.

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2012-03-12T07:39:31+00:00

    As Suzanne suggests, if the line is to be level with the centre of the text height then it is a bit fiddly to achieve manually, but you can do it with a macro.

    Type the heading text at the left margin then run the following macro, which sets tabs at the centre and right margins with underline leaders, then tabs are added before and after the text and formatted raised to the height ot the font divided by 2.5, which should be near enough the centre. You can adjust that figure to whatever you need to produce the effect you are after

    Sub AddLines()

    Dim iWidth As Long, iLM As Long, iRM As Long, iCentre As Long

    Dim oHT As Long

    Dim oRng As Range

    With Selection.Sections(1).PageSetup

        iLM = .LeftMargin

        iRM = .RightMargin

        iWidth = .PageWidth

    End With

    'find the cenre of the page between the margins

    iCentre = ((iWidth - (iLM + iRM)) / 2)

    'Clear any existing tabs and add a tab at the centre and another at the right margin

    With Selection.ParagraphFormat.TabStops

        .ClearAll

        .Add Position:=iCentre, _

             Alignment:=wdAlignTabCenter, _

             Leader:=wdTabLeaderLines

        .Add Position:=iWidth - iLM - iRM, _

             Alignment:=wdAlignTabRight, _

             Leader:=wdTabLeaderLines

    End With

    'define the paragraph text as a range

    Set oRng = Selection.Paragraphs(1).Range

    oRng.End = oRng.End - 1

    'establish the font size of the first character

    oHT = oRng.Characters(1).Font.Size

    'add a tab before and a space and tab after the text

    oRng.InsertBefore vbTab

    oRng.InsertAfter Chr(32) & vbTab

    'move the range start and end to include the tabs

    oRng.Start = oRng.Start - 1

    oRng.End = oRng.Paragraphs(1).Range.End

    'locate and format the tabs by raising the font

    With oRng.Find

        Do While .Execute(FindText:=Chr(9))

            oRng.Font.Position = oHT / 2.5

        Loop

    End With

    'collapse the range

    oRng.Collapse wdCollapseEnd

    'and select it to continue typing from that point

    oRng.Select

    End Sub

    http://www.gmayor.com/installing_macro.htm

    0 comments No comments