Manual Line Breaks in STYLEREF Results

Written by Allen Wyatt (last updated January 6, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


Samantha uses the STYLEREF field in the heading of my document. If the paragraph style (a heading) on the page contains a manual line break (Shift+Enter), that break also appears in the STYLEREF result in the document header. Samantha wonders if there is a way to get the STYLEREF result to not include the line break and still use the line break in the document itself.

The purpose of the STYLEREF field is to return whatever text is formatted with a particular style. For instance, if you have text on a page that is formatting using the Heading 1 style, then you can use the STYLEREF field in the page header or footer to display that text. If the text contains special characters, such as tabs or manual line breaks, then those are included in what the STYLEREF field returns—just as Samantha is seeing.

There is no way to get STYLEREF to ignore certain characters, such as the manual line break. The only thing you can do is to find a way to not include a manual line break in your text. The absolute easiest way to handle this situation is to change how you use the styles. For instance, let's say that you are using the Heading 2 style and this is what you are wanting referenced in the STYLEREF field. Instead, create two styles, such as Heading 2a and Heading 2b. Use Heading 2a for the first line of your heading and Heading 2b for the second line. In this way, your heading will not need to include a manual line break. Then, in your page header, you could use two STYLEREF fields:

{ STYLEREF "Heading 2a" } { STYLEREF "Heading 2b" }

This places the two lines of the heading right next to each other in the page header, just as you want.

If you don't want to use two styles in this manner, you can try setting tab stops and using these to remove the need to use a manual line break. For instance, in your heading style, define a tab stop at something like 0.01 inches and another just before the right margin. (As an example, for a 6.5 inch text width, you could set a tab stop at 6.49 inches.)

Now, type the first part of your heading's text, and where you would normally press Shift+Enter, instead press Tab. Since any text that you type after the tab character won't fit on the line, Word will automatically move it to the next line. So, you end up with two lines of text without the need of using Shift+Enter. You can then adjust your header style so that the tab stops don't affect the appearance of text on that line.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (9036) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Synchronized Workbook and Worksheet Names

When you work on older workbooks in Excel, you may notice that the name of the worksheet tab and the workbook itself are ...

Discover More

Selecting Printing of Color Pictures

Do you want to control whether color pictures in your document are printed or not? It's not quite as easy as it may ...

Discover More

Taking Bold Text into Account in a Sort

If you have some data in a worksheet that is bold, you may want to sort that data based on the text attribute. This is ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Starting Chapters on Odd-Numbered Pages

Want to start a new heading on an odd-numbered page? You can do it with section breaks, obviously, but you can also do it ...

Discover More

Field Calculations in Locked Forms

When adding form fields to a document, you may want some of the fields to be automatically calculated from other fields. ...

Discover More

Finding Fields

Fields allow you to add simple dynamic content to your document. Here's how you can find the fields when you need to know ...

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

2024-01-06 15:57:42


To help avoid confusion I will use header and HEADING in the text below/
There are some additional details to the second approach from this tip, that may help you understand better how it works and also make it a bit easier to implement. I am taking a liberty to add them here as I contributed to this part of the tip

First let's look at the tab settings in the header. You can ***creatively*** use the right-align tab. Normally it is used to right align the text after the tab, but if that text is too long to fit in the space allotted for that tab, the text will move left to occupy only the free space, either to the end of the text before the tab, or to the left margin. Whatever doesn't fit there will extend beyond the right-align tab, kinda breaking what the tab is supposed to do, but useful in case of this tip.

You can set such tab so that it will be after the longest first line of the HEADING by at least one character. This way, putting a space and a tab instead of a manual line break in your HEADING will cause the two lines from the HEADING to display separated with a space, but as desired in one line. It will take care of varying lengths of both lines in the HEADING without having to adjust tab setting for each header. It may not handle properly cases where some of the first lines in different HEADING are very short, and others quite long, but you can play with setting more than one right-align tab stop in the header.

You can use the same trick in setting tabs in the HEADING. Instead of the first left-align tab at 0.01 inches you can set that tab to be right aligned. This will push the text against the left margin. If you used the left-align tab there, the second line of the HEADING will be offset from the margin by 0.01 inches - hardly visible but you would know it is there.

One more detail: That tab at 0.01 inches is necessary to avoid the tab character taking a line by itself. It also cannot be set at 0.00 inches. However, if using the right-align tab, you can set it a bit further from the margin (easier to do with a mouse), as long as the second line of the HEADING doesn't fit before it.

If you read this please let me know (post or my e-mail is un-hidden) if you would use the second solution, or prefer the first one from the tip.

This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.


FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.