Applying a style causes loss of character formats! Why?

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Applying a style causes loss of character formats! Why?

Post by Rudi »

Hi,

To all the Word experts out there, please could you provide some clarity on this annoying issue?

(See the attached sample document to preview the issue...)
Test.docx
I have a style called: "Gray Courier Quote". It is a Linked (Paragraph and Character) type style. I assume it needed to be this type as I want it to retain specific character formats like bold, italic and underline, whilst still being able to apply a gray shading to the paragraph.

BUT, the text that I'm formatting (which is copied from web pages and pasted using Words "Merge Formatting" option) has mixed results. Some paragraphs retain all emphasis formatting while other paragraphs lose bolding emphasis? This requires me to have to reapply bold after I have applied the style.... an inconsistent and rather annoying exercise!

Does anyone have any advice to avoid this issue happening, or advice to rectify actions I might be overlooking.

Many TX.
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Charles Kenyon
5StarLounger
Posts: 615
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Applying a style causes loss of character formats! Why?

Post by Charles Kenyon »

I hate and discourage use of "linked" styles. I disable them on my computers.
A paragraph style can have character formatting.
If applied to a paragraph that already has character formatting, directly applied or through a character style, it will not change that formatting unless the formatting influences at least 50% (maybe more than 50%) of the text. If more than 50%, then the other formatting is overridden by the paragraph style.

Understanding Styles in Microsoft Word http://www.addbalance.com/usersguide/styles.htm

User avatar
Jay Freedman
Microsoft MVP
Posts: 1318
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Applying a style causes loss of character formats! Why?

Post by Jay Freedman »

The Word MVPs have argued against this algorithm for at least the last 15 years, to no avail. The main argument, of course, is that almost no users know about it, so they're left with the same "why?" as Rudi asked. The secondary argument is that even when you know about it, how are you supposed to recognize whether the existing formatting is slightly less than 50% or slightly more than 50%?

We recommended addition of an option to disable the algorithm and provide explicit paste behavior, but as far as I know that's never been on the list for consideration for development.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Applying a style causes loss of character formats! Why?

Post by Rudi »

TX guys. So I take it then that this annoyance is currently unavoidable?
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15611
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Applying a style causes loss of character formats! Why?

Post by ChrisGreaves »

Jay Freedman wrote:...how are you supposed to recognize whether the existing formatting is slightly less than 50% or slightly more than 50%?
And even if you could determine the Boolean - whether you are above, or below, the 50% mark, that could change with the deletion or insertion of one character. A space character, for example.
Cheers
Chris
There's nothing heavier than an empty water bottle

st3333ve
NewLounger
Posts: 13
Joined: 10 Jan 2011, 03:12

Re: Applying a style causes loss of character formats! Why?

Post by st3333ve »

I do virtually all my style-applying with macros, and that annoying behavior doesn't happen if the macro uses search/replace to change a paragraph's style. Sample code:

Code: Select all

With rngX.Find
	.Style = strOldStyle
	.Replacement.Style = strStyle
	.Execute Replace:=wdReplaceOne
End With