Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

style overriding in MS Word

Status
Not open for further replies.

AzizKamal

Programmer
Apr 6, 2010
122
PK
I created a new file testone.docx in Microsoft Word 2013. I typed =rand(1,5) and pressed enter to generate a random paragraph of five sentences.
Then I clicked Ctrl+A, selected Times New Roman, 12 points. In the paragraph, I selected one sentence and made it Italic. Now the total words in the paragraph are 80 words, out of which 17 words are italic. Then I selected the whole paragraph, clicked the down arrow in Paragraph Group of Home tab, selected First line 0.5", before and after spacing 0 pt, and Line spacing double, and clicked OK.

While the paragraph is still selected, I selected Create a Style and entered Name as MyFirstStyle in Create New Style from Formatting dialog box. Now I have a new style MyFirstStyle available.

Then I typed a new paragraph in Normal style with some words in Regular font and some words in Italic font. The paragraph had total 93 words, out of which 17 words were in Italic. It is shown below:

Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.

When I selected the whole paragraph and applied MyFirstStyle, the words in Italic remained in Italic. Then I typed another paragraph in Normal Style with some words in Regular font and some words in Italic font. The paragraph had total 102 words, out of which 81 words were in Italic. It is shown below:

To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries. Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them.

This time, when I selected the whole paragraph and applied MyFirstStyle, the words in Italic did not retain their formatting and the whole paragraph changed to Regular font. I need to create a MyFirstStyle so that Italic words always retain their Italic formatting, regardless of how much is the percentage of Italic words in the whole paragraph.
 
There is a difference between paragraph style and character style.
The "styles" you refer to are paragraph styles, meaning they style entire paragraphs. Individual formatting of individual words or characters is character styling.
This will always be overridden by paragraph style as soon as a new paragraph style is being applied.

Please anyone correct me if I'm wrong, but AFAIK there is absolutely no way to create a paragraph sytle that retains individual character styles.

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Thanks MakeItSo

I think there is something more to it. I read in a web page:
If you apply a style to a paragraph, and less than half the text in the paragraph has direct formatting, then Word retains the direct formatting.
If you apply a style to a paragraph, and more than half the text in the paragraph has direct formatting, then the style overrides the direct formatting.


Still, I am unable to comprehend this rule in my examples. I think the percentage of Italic words in the paragraph are affecting the formatting, that's why I gave two examples.
 
If I apply a new style to your first example, all italics get lost.

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Thanks MakeItSo

If you created a custom style MyFirstStyle as in my example, italics would remain in the first example, but not in the second example. Try this:

1. Open a blank Word document
2. Type =rand(1,5) and press Enter. You will get the following paragraph:

Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar.

3. Make the third sentence Italic so that the paragraph looks as follows:

Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar.

4. Select All, Times New Roman, 12, Create a Style, enter the name MyFirstStyle, OK

5. Now from the Styles Gallery, select Normal. Type =rand(2,6) and press Enter. You will get two paragraphs as follows:

Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.


Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.


6. In the first paragraph, make the second sentence Italic. In the second paragraph, make everything from second sentence onward Italic. The two paragraphs will now look as follows:

Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document. To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.

Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme. Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.

7. Now click anywhere in the First Normal style paragraph and select MyFirstStyle. The second sentence will remain Italic.

8. Now click anywhere in the Second Normal style paragraph and select MyFirstStyle. All italics will be gone and the whole paragraph will be in Regular font (and this is what I would like to prevent).

 
I read another article that explains the general rule related to it:

If more than half the text in the paragraph has been applied bold, italics, underline or other types of direct formatting, this formatting is overridden when you apply a style, otherwise the direct formatting is preserved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top