Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
christophercbrewster via OfficeKB.com christophercbrewster via OfficeKB.com is offline
external usenet poster
 
Posts: 68
Default Styles incorrectly inheriting from another style in tables

I got some bizarre formatting behavior recently, twice. Both problems
occurred in tables but they involved paragraph styles. A group of styles
somehow took one bit of formatting from another style. The other style had
nothing to do with the ones that were affected-- no inheritance etc, and
never used in a table. The first time I couldn't remedy it until I did "Clear
formatting" on a paragraph. Then the style shown for that paragraph changed
from its assigned style to the unwanted style-- it was somehow buried "under"
the correct one and affecting it. Fortunately I didn't need the unwanted
style for anything else, so I deleted it and the problem went away. Then
something similar happened to some other paragraphs, also in tables, and a
whole other unwanted style was affecting them. I solved that one the same way.
Again I can't find an inheritance relationship, and the unwanted style has
not been used in tables. Any ideas about what this is?

--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.word.newusers
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default Styles incorrectly inheriting from another style in tables

Hi Christopher,

I'm sure you know that some text can be formatted with a paragraph style and a character style at the same time.

Unfortunately, Word2002 introduced a new concept, linked styles. A paragraph style and a character style can be linked, so that when you apply the paragraph style to part of a paragraph, Word automatically applies the linked character style.
Word will also automatically create a character style linked to the paragraph style when you apply the paragraph style to part of a paragraph... which mostly isn't anything you do on purpose, but which is pretty much impossible to prevent from happening accidentally if you are not very careful, especially if you format text in tables.

On top of this mess, paragraph styles seem to become linked to paragraph styles for no good reason at all. I don't know how this happens, but cleaning up docs is a big part of my job, and I often get docs where custom or built-in character styles (say the HTML styles for code, acronyms, examples, definitions, ...) are linked to paragraph styles haphazardly.

One thing you can do, if you haven't done so already, is to install the latest updates for your version, or move to Word2007.
I haven't seen as many issues with linked styles in docs that came from current 2003 installations or Word 2007 as I used to in Word 2002.

If it happens again, open the VBA editor (Alt+F11), go to the immediate window (Ctrl+G).
Type
? ActiveDocument.Styles("myProblematicStyle").LinkSt yle
using the names of the two problematic styles (... one of them is likely a character style, the other a paragraph style), and hit the Return key at the end of the line.

If you find the styles are linked to each other (that is, the line above returns the paragraph style for the character style and vice versa), you can remove the link by linking the paragraph style [!!] to the "Normal" paragraph style:
ActiveDocument.Styles("myProblematicStyle").LinkSt yle=ActiveDocument.Styles(wdStyleNormal)
(You'd expect you would have to link the character style to "Normal", but it works the other way around. Doing it for both styles shouldn't hurt, I guess).

Doing the above should not destroy any formatting (... no guarantees ....), but once you unlink the styles, Word will display the character style that is actually applied, which it previously hid (displaying only the linked paragraph style in the styles dropdown and styles pane).
So now it should be easy to clean up the mess, replacing the character style with the "Default Paragraph Font" or some actually sensible character style.

Regards,
Klaus



"christophercbrewster via OfficeKB.com" u3143@uwe wrote:
I got some bizarre formatting behavior recently, twice. Both problems
occurred in tables but they involved paragraph styles. A group of styles
somehow took one bit of formatting from another style. The other style had
nothing to do with the ones that were affected-- no inheritance etc, and
never used in a table. The first time I couldn't remedy it until I did "Clear
formatting" on a paragraph. Then the style shown for that paragraph changed
from its assigned style to the unwanted style-- it was somehow buried "under"
the correct one and affecting it. Fortunately I didn't need the unwanted
style for anything else, so I deleted it and the problem went away. Then
something similar happened to some other paragraphs, also in tables, and a
whole other unwanted style was affecting them. I solved that one the same way.
Again I can't find an inheritance relationship, and the unwanted style has
not been used in tables. Any ideas about what this is?

--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via http://www.officekb.com

  #3   Report Post  
Posted to microsoft.public.word.newusers
christophercbrewster via OfficeKB.com christophercbrewster via OfficeKB.com is offline
external usenet poster
 
Posts: 68
Default Styles incorrectly inheriting from another style in tables

Thanks for the highly informative reply. (There's always a new Word mystery
to be cleared up!) Are you saying that it's *better* for styles to inherit
from Normal? I actually thought it was better to have less inheriting in
general, but you seem to say that inheriting from Normal protects a style
from these random corruptions by other styles... do I have it right?

FWIW, both styles in my case were paragraph styles-- I never use character
styles but use macros (on hot keys) to change fonts if more than one thing
has to change. I found this avoided some of the craziness of styles getting
tangled with each other.

Your job sounds a little like, uh, following elephants in a parade? Thanks
again.

Klaus Linke wrote:
Hi Christopher,

I'm sure you know that some text can be formatted with a paragraph style and a character style at the same time.

Unfortunately, Word2002 introduced a new concept, linked styles. A paragraph style and a character style can be linked, so that when you apply the paragraph style to part of a paragraph, Word automatically applies the linked character style.
Word will also automatically create a character style linked to the paragraph style when you apply the paragraph style to part of a paragraph... which mostly isn't anything you do on purpose, but which is pretty much impossible to prevent from happening accidentally if you are not very careful, especially if you format text in tables.

On top of this mess, paragraph styles seem to become linked to paragraph styles for no good reason at all. I don't know how this happens, but cleaning up docs is a big part of my job, and I often get docs where custom or built-in character styles (say the HTML styles for code, acronyms, examples, definitions, ...) are linked to paragraph styles haphazardly.

One thing you can do, if you haven't done so already, is to install the latest updates for your version, or move to Word2007.
I haven't seen as many issues with linked styles in docs that came from current 2003 installations or Word 2007 as I used to in Word 2002.

If it happens again, open the VBA editor (Alt+F11), go to the immediate window (Ctrl+G).
Type
? ActiveDocument.Styles("myProblematicStyle").LinkSt yle
using the names of the two problematic styles (... one of them is likely a character style, the other a paragraph style), and hit the Return key at the end of the line.

If you find the styles are linked to each other (that is, the line above returns the paragraph style for the character style and vice versa), you can remove the link by linking the paragraph style [!!] to the "Normal" paragraph style:
ActiveDocument.Styles("myProblematicStyle").LinkS tyle=ActiveDocument.Styles(wdStyleNormal)
(You'd expect you would have to link the character style to "Normal", but it works the other way around. Doing it for both styles shouldn't hurt, I guess).

Doing the above should not destroy any formatting (... no guarantees ...), but once you unlink the styles, Word will display the character style that is actually applied, which it previously hid (displaying only the linked paragraph style in the styles dropdown and styles pane).
So now it should be easy to clean up the mess, replacing the character style with the "Default Paragraph Font" or some actually sensible character style.

Regards,
Klaus

I got some bizarre formatting behavior recently, twice. Both problems
occurred in tables but they involved paragraph styles. A group of styles

[quoted text clipped - 9 lines]
Again I can't find an inheritance relationship, and the unwanted style has
not been used in tables. Any ideas about what this is?


--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200711/1

  #4   Report Post  
Posted to microsoft.public.word.newusers
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default Styles incorrectly inheriting from another style in tables

Hi Christopher,

Are you saying that it's *better* for styles to inherit
from Normal?


No, this hasn't got to do with inheritance. Setting the LinkStyle to "Normal" is just re-setting it to what's the default.
*Why* that's the default, I have no idea. It does not even make any sense to me.


I actually thought it was better to have less inheriting in general,
but you seem to say that inheriting from Normal protects a style
from these random corruptions by other styles... do I have it right?


See above. If you want my opinion anyway, it's good to have styles inherit as much as possible, but just because it keeps it easy to manage and change the styles, not because of "corruption". There are reasons not to base the inheritance chain on "Normal" (see below for one... Another one is that many built-in styles are based on "Normal". As long as you leave "Normal" alone, their factory definitions are pretty sensible. If you change it, you're responsible.)
There are reasons for using "Normal" and basing the other styles on it, too. Say, most documents around use Normal as the text style, and if you copy/paste a lot, you don't have to apply *your* text style each time.
It used to be my impression that the original designers *wanted* us to use and customize Normal, and base other styles on it. If that's no longer the case, it is IMO because the developers lost track of the original design.


FWIW, both styles in my case were paragraph styles-- I never use character
styles but use macros (on hot keys) to change fonts if more than one thing
has to change. I found this avoided some of the craziness of styles getting
tangled with each other.


If linked styles are the problem (... and I'm not sure of that), Word would not display the linked character style. That's the point of the VBA lines of code I posted: To find the linked character style if it should exist, and turn it into a regular character style.
In tables, there may well be additional issues, since you also have to deal with the table style. Table styles don't work as you'd expect them if you have modified the Normal paragraph style (... which is one reason you may want to leave the Normal paragraph style alone, and base your styles on, say, "Body Text" instead).


Your job sounds a little like, uh, following elephants in a parade?


It used to be elephants (Word, StarWriter, XYWrite, WordPerfect...). Today, it's only one. But it produces a lot of... err... dung g


Thanks again.


You're welcome! It's a bit difficult to diagnose what's wrong without seeing the doc. If you run into issues again, you can mail me a sample.

Regards,
Klaus
  #5   Report Post  
Posted to microsoft.public.word.newusers
christophercbrewster via OfficeKB.com christophercbrewster via OfficeKB.com is offline
external usenet poster
 
Posts: 68
Default Styles incorrectly inheriting from another style in tables

Klaus-- I was innocently trying to clean up my template to have fewer things
to link to other things, and my document got really hosed, again styles
within tables. So I tried your snippet of VBA (with the appropriate style
name inserted), and got the message "Invalid use of property". Any idea why
this didn't work? Thanks...

Klaus Linke wrote:
Hi Christopher,

Are you saying that it's *better* for styles to inherit
from Normal?


No, this hasn't got to do with inheritance. Setting the LinkStyle to "Normal" is just re-setting it to what's the default.
*Why* that's the default, I have no idea. It does not even make any sense to me.

I actually thought it was better to have less inheriting in general,
but you seem to say that inheriting from Normal protects a style
from these random corruptions by other styles... do I have it right?


See above. If you want my opinion anyway, it's good to have styles inherit as much as possible, but just because it keeps it easy to manage and change the styles, not because of "corruption". There are reasons not to base the inheritance chain on "Normal" (see below for one... Another one is that many built-in styles are based on "Normal". As long as you leave "Normal" alone, their factory definitions are pretty sensible. If you change it, you're responsible.)
There are reasons for using "Normal" and basing the other styles on it, too. Say, most documents around use Normal as the text style, and if you copy/paste a lot, you don't have to apply *your* text style each time.
It used to be my impression that the original designers *wanted* us to use and customize Normal, and base other styles on it. If that's no longer the case, it is IMO because the developers lost track of the original design.

FWIW, both styles in my case were paragraph styles-- I never use character
styles but use macros (on hot keys) to change fonts if more than one thing
has to change. I found this avoided some of the craziness of styles getting
tangled with each other.


If linked styles are the problem (... and I'm not sure of that), Word would not display the linked character style. That's the point of the VBA lines of code I posted: To find the linked character style if it should exist, and turn it into a regular character style.
In tables, there may well be additional issues, since you also have to deal with the table style. Table styles don't work as you'd expect them if you have modified the Normal paragraph style (... which is one reason you may want to leave the Normal paragraph style alone, and base your styles on, say, "Body Text" instead).

Your job sounds a little like, uh, following elephants in a parade?


It used to be elephants (Word, StarWriter, XYWrite, WordPerfect...). Today, it's only one. But it produces a lot of... err... dung g

Thanks again.


You're welcome! It's a bit difficult to diagnose what's wrong without seeing the doc. If you run into issues again, you can mail me a sample.

Regards,
Klaus


--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200711/1



  #6   Report Post  
Posted to microsoft.public.word.newusers
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default Styles incorrectly inheriting from another style in tables

"christophercbrewster via OfficeKB.com" u3143@uwe wrote:
Klaus-- I was innocently trying to clean up my template to have fewer things
to link to other things, and my document got really hosed, again styles
within tables. So I tried your snippet of VBA (with the appropriate style
name inserted), and got the message "Invalid use of property".
Any idea why this didn't work? Thanks...


If you tried the line of code using the name of a table style or list style, that might explain the error message.

You can mail me a sample doc, if you want to, and maybe a sentence or two in what way you think the doc is "hosed".

Regards,
Klaus
  #7   Report Post  
Posted to microsoft.public.word.newusers
christophercbrewster via OfficeKB.com christophercbrewster via OfficeKB.com is offline
external usenet poster
 
Posts: 68
Default Styles incorrectly inheriting from another style in tables

I don't see a way to send email to one person, plus I already got rid of the
corrupted version of the document. (It looked like a major traffic accident.)
When I had tried to get rid of unneeded styles, Word decided to make the text
in tables look like my Heading 2: bold, all-cap, and even numbered. My
attempts to clean it up got nowhere. The style that I used in your bit of
code was Table Text. Fortunately I had saved an iteration before I made this
attempt, and I revived that.

I'm wondering why this behavior has occurred mostly in tables: I assume it's
related to table styles, but I don't see how to reform those. One conclusion
I have is that I shouldn't create new templates by copying old ones and
modifying. I'm considering starting from scratch with a new template and see
if I can prevent this craziness. Do you think the document made from the old
template would go haywire with the new template?

Thanks for your offer of help.

Klaus Linke wrote:
Klaus-- I was innocently trying to clean up my template to have fewer things
to link to other things, and my document got really hosed, again styles
within tables. So I tried your snippet of VBA (with the appropriate style
name inserted), and got the message "Invalid use of property".
Any idea why this didn't work? Thanks...


If you tried the line of code using the name of a table style or list style, that might explain the error message.

You can mail me a sample doc, if you want to, and maybe a sentence or two in what way you think the doc is "hosed".

Regards,
Klaus


--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200711/1

  #8   Report Post  
Posted to microsoft.public.word.newusers
christophercbrewster via OfficeKB.com christophercbrewster via OfficeKB.com is offline
external usenet poster
 
Posts: 68
Default Styles incorrectly inheriting from another style in tables

I realized that your code snippet represents a value, but I needed to *do*
something with it. So I made it into a message:

msgbox ActiveDocument.Styles("Table Grid").LinkStyle

Every style I use as an argument above simply returns "Normal", so it hasn't
uncovered the issue yet.

--
Christopher Brewster
Lockheed Martin, Eagan MN

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/200711/1

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Styles in table inherit indent from Normal, incorrectly christophercbrewster via OfficeKB.com Tables 5 October 18th 07 02:03 PM
For the archive, code to format (styles and column widths) tables and nested tables kbutterly Tables 0 January 24th 07 02:00 PM
Styles in a Style-Less Environment SV Page Layout 6 August 7th 06 01:06 PM
Styles applying incorrectly Darren Page Layout 2 March 11th 06 06:32 PM
Preventing styles from inheriting formats Eric G Microsoft Word Help 5 January 13th 06 08:44 AM


All times are GMT +1. The time now is 09:29 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"