Applying a paragraph style SOMEtimes wipes out bold/ital--why?

B

Benjamino5

Hi all,

This is a very odd problem, much more easily explained with a sample file,
which I can email to you if you're interested.

Simply put, I'm applying a paragraph style in Word XP (2002) to various
paragraphs. The style does not apply or remove bold, italics, or underlines,
so I assumed it wouldn't affect those character styles when they're present
in the paragraphs I'm styling. Mostly, that's the case, but not always. Which
is very confusing to me!

There are three basic scenarios, and the third one does NOT act the way I
think it should:

1) I apply the style to a "Normal" paragraph with SOME bold or italics. As
expected, the bold and italics remain after the style has been applied.

2) I apply the style to a "Normal" paragraph that is ENTIRELY bold,
italicized, or both. Word XP seems to treat the bold/ital as a modification
of the "Normal" paragraph style ("Normal+Bold", say, for the whole para)
instead of being character styles. Therefore, the style I applies wipes out
the bold/ital. I guess I can see why that would happen.

3) This is the mystery. I have a row in a two-column table in which one cell
is entirely bold and one is not. I merge the two cells, then replace the
paragraph mark Word inserts with a tab, so it's all one paragraph. The
resulting paragraph consists of non-bold text, then a tab, then bold text.
Applying the style to this paragraph wipes out the bold. If I copy and paste
this paragraph outside the table, the same thing happens.

The end result is a sample file I can send in which there are two
paragraphs, one from scenario 1 and one from scenario 3. They both LOOK the
same--they're not bold until the last word. But applying the same style to
each causes bold to be kept in the first case and dropped in the second.

I know that scenario 3 is complicated, but I can't tell why the merging,
find-and-replace of the tab, etc. would cause that paragraph to behave
strangely.

Finally, to conclude this epic post, this is not limited to any particular
set of paragraphs--it happens consistently across many hundreds of pages of
material.

Anyway, the sample file is far easier to understand than this lengthy post,
so let me know if you want to see it.

Many thanks in advance--I'm afraid I really don't understand the "Paragraph
Style + Character Style" issues at all.

Ben
 
S

Shauna Kelly

Hi Benjamino5

For info about why the bold is sometimes replaced by a paragraph style see:
Why does Word sometimes override bold and italics when I apply a paragraph
style, but sometimes it does not?
http://www.ShaunaKelly.com/word/stylesoverridedirectformatting/index.html
Word XP seems to treat the bold/ital as a modification
of the "Normal" paragraph style ("Normal+Bold"

Not quite. "Normal+Bold" indicates that the paragraph is in style Normal and
Bold has been added as direct formatting. For more information, see
How the Styles and Formatting pane works in Word 2002 and 2003
http://www.ShaunaKelly.com/word/sfpane/StylesAndFormattingPane.html

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
K

Klaus Linke

Hi Benjamino,

re 1 & 2, the behaviour is different depending on whether more or less than
50% of the characters have manual formatting applied.

I've worked with Word for over a decade, and it still drives me bonkers.

I often apply styles using "Find/Replace", rather than from the styles
control or pane, because it avoids the issue.

re 3, I can't quite figure out what you are doing, but I suspect style
formatting may be competing with manual formatting. If you want, you can
mail me the file.

Regards,
Klaus
 
K

Klaus Linke

Hi Ben,

In the sample you mailed me, it was the 50% rule that caused the difference.

A) *unconstitutional*
--> more than 50%, manual bold formatting removed when you apply the new
style.

constitutional under all *circumstances*.
--> less than 50% manually bolded, manual formatting retained.

Regards,
Klaus
 
B

Benjamino5

Shauna, Klaus,

Thank you both so much. Shauna, your website is incredibly helpful--I told
my coworkers about it, and I'm sure we'll all be getting a lot of tips from
it.

For my project, it seems that there are two approaches I can take to style
and yet keep ALL direct formatting, even if it's more than 50% of a given
paragraph:

1) Use a Find/Replace operation, because, as Klaus says, it doesn't rely on
the 50% rule.

2) Insert HTML style tags (like <b> and </b>) around all direct formatting
before running the bulk of the code, then style everything, and then remove
the tags and format what was between the tags as needed.

It seems like both approaches will work--but is there anything else I should
consider? Right now, I'm going to try both approaches to see which one will
fit better into my code (both in terms of speed and in terms of simplicity).

Ben
 
S

Shauna Kelly

Hi Ben

Option 2 requires you to make a lot of assumptions about the nature of the
document. You'll have to code for a score or more of possible types of
direct formatting. And your code will have to navigate around anything that
isn't plain text: tables, inline images, floating shapes, frames, footnotes,
endnotes, cross-references, comments etc.

Go with Option 1.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
B

Benjamino5

I see what you mean--thanks for the tip!

Shauna Kelly said:
Hi Ben

Option 2 requires you to make a lot of assumptions about the nature of the
document. You'll have to code for a score or more of possible types of
direct formatting. And your code will have to navigate around anything that
isn't plain text: tables, inline images, floating shapes, frames, footnotes,
endnotes, cross-references, comments etc.

Go with Option 1.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top