Changing a large number of styles

J

Jeff Wiseman

John said:


Is there a way to do this from a menu item?

That changes the style of the underlying paragraph. If the style is the
only formatting present, that will change the resulting format of the text.
However, many inexperienced users, particularly in corporations, have no
idea of styles. They format the entire document with direct formatting:
instead of consistent named collections of formatting (i.e. "Styles") they
format their documents by applying dozens of individual formatting
properties to each piece of text.

This formatting is applied over the top of the style formatting. You have
to either correct it the same way they applied it, one individual property
at a time for each run of text (e.g. A sentence or a paragraph), or you have
to remove the direct formatting so that you can efficiently repaire the mess
they have made.


So it sounds like you are saying that Only the "style" component
of the formatting is changed and any direct formatting that was
there will still override the style, right?

When I have a given styled paragraph selected and then I select
that very same style from the formatting toolbar styles pulldown
menu, I typically would get a dialog box where I could select
"Reapply the formatting of the style to the selection". When I
have tried this in the past, it usually seemed to work and would
override most direct formatting (e.g., if some text in the
paragraph was directly formatted to be Bold, reapplying a
non-bold style would cause that formatting to be tossed. However
occasionally some other types of formatting would not). If
reapplying the same style only updates just the style formatting,
leaving all other direct formatting in place, why might I be
seeing the above behavior?

Come on Jeff, you're only half awake -- give you a holiday and look what
happens -- brain's out of service when you return. :) You know the answer
to that just as well as I do :)


Errr, well, um...

Actually I don't (you know it better than I :) I honestly still
haven't quite figured out some of the details on this silly
thing. I'm further handicapped by having used word layout tools
that actually have intuitive and consistent interfaces with
respect to styles (or paragraph types, etc.) for the last 2
decades. I keep trying to think of the obvious which is almost
never the case here...

It appears that Styles in Word should be viewed as a type of
"Format collection" rather than a "paragraph type" as is used on
word processing applications that I've used. I think that this
may be where my misunderstanding is coming from.

Normal is the "Default formatting". It could just as easily be named "Style
0" or "Undefined". In fact, "Undefined" is closer to what it means. The
point is that neither a template nor a document can exist without it.


I have no idea of why they call it "Normal" since it is the one
thing that seems to behave totally DIFFERENT from every other
similar component in the application. All other styles in a
document behave "normally", Normal does not :-(

If I have a paragraph of style "xyzzy" and I "clear its
formatting" with the Edit->Clear->Clear Formatting directive, the
style of the paragraph changes to Normal. Actually, it doesn't
really CHANGE to normal but rather the removal of the "xyzzy"
format set (i.e. "style") simply re-exposes the paragraph to the
"no style" CONDITION which uses the base formatting called
Normal. This means that all other styles simply override the base
formatting called Normal. Normal is referred to as a style even
though applying it to a paragraph with a different style doesn't
override or replace the style as much as it just plain deletes it.

Ok, So I'm seeing now that this is the mechanism that Word uses
to deal with the fact that any empty document must have at least
one (empty) paragraph in it. Since any paragraph that exists must
have a style, Normal is it. I would then presume that for this
reason the Normal "style" cannot ever be deleted from a document.
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Jeff:

Is there a way to do this from a menu item?

Yes: But you have to use the Customise facility to place the ResetChar and
ResetPara commands on your favourite menu. The commands already appear in
the All Commands list, you simply have to assign them to a menu.
So it sounds like you are saying that Only the "style" component
of the formatting is changed and any direct formatting that was
there will still override the style, right?
Correct.

When I have a given styled paragraph selected and then I select
that very same style from the formatting toolbar styles pulldown
menu, I typically would get a dialog box where I could select
"Reapply the formatting of the style to the selection". When I
have tried this in the past, it usually seemed to work and would
override most direct formatting (e.g., if some text in the
paragraph was directly formatted to be Bold, reapplying a
non-bold style would cause that formatting to be tossed. However
occasionally some other types of formatting would not). If
reapplying the same style only updates just the style formatting,
leaving all other direct formatting in place, why might I be
seeing the above behavior?

When "applying a style" to a "selection", a series of complex rules are
followed. They used to document them, but they have become so horrendously
complex that I think they have given up.

The Help topic "What formatting is applied when you copy text between
documents?" used to contain a lot more information (on the PC...) than it
does now. Basically: If you select less than 3/4 of a paragraph, Word does
funny things and wipes out direct formatting. If you select all or none of
a paragraph, Word applies the style and leaves the direct formatting intact.

1) If there are paragraph marks selected, or the selection is only an
insertion point, applying a style changes the underlying style of the
paragraph.

2) If there are no paragraph marks selected, and the selection is greater
than one character, and the selection is less than 75 per cent of the
characters in the paragraph, then Word attempts to apply the Font properties
of the style. That happens three ways, depending on the version of Word.
Early versions of Word do nothing if the para mark is not in the selection
and the style being applied is a para style. Versions after Word 2000 apply
the formatting as direct formatting. Versions of Word after 2002 (PC) or X
(Mac) apply the formatting by creating a character style linked to the
paragraph style and applying that.

3) If the selection is greater than 75 per cent of the paragraph, whether
it includes the para mark or not, Word applies the paragraph style to the
entire paragraph.

If the selection contains direct formatting overriding the style, Word will
remove the direct formatting. If the paragraph contains direct formatting
that is NOT in the selection, In the case of 1) or 3), Word will retain the
direct formatting. In the case of 2, Word appears to do an algebraic
addition of the formatting properties. This seems to happen most often with
"Bold" and "Italic". If you apply a style that includes bold to a selection
that includes some bold characters, those characters will be toggled to
regular.

It would be helpful at this point if someone with no need for a life would
sit down and carefully test the thousands of cases required to prove whether
what I say above is all true. What we're talking about here is Word's
"Smart Cut and Paste" algorithm. Like I say, Microsoft appears to have
ceased to document it, and that's probably because the mechanics are now so
complex that only a computer could figure out what is going to happen. If
you can figure it out, good luck to you...
It appears that Styles in Word should be viewed as a type of
"Format collection" rather than a "paragraph type" as is used on
word processing applications that I've used. I think that this
may be where my misunderstanding is coming from.

Correct. Styles in Word have always been a collection (as they are in the
high-end publishing systems I started my working life with). A newspaper
typically has several hundred "styles" that may or may not be cascading,
depending on the publishing system.

In Word, a paragraph can have several hundred properties. One of those
properties is its "style". The Style is simply a pointer to a collection of
formatting properties. So Word has a collection of styles, each style in
which is a collection of formatting properties.

If the style has been created by or for a user, the pointer will be a
human-readable "name" (e.g. "Heading 1"). If the style is something Word
created on the fly for its convenience, the "name" is actually a hexadecimal
integer, and the formatting palette then displays the names of the first few
properties of the style in place of a name.
I have no idea of why they call it "Normal" since it is the one
thing that seems to behave totally DIFFERENT from every other
similar component in the application. All other styles in a
document behave "normally", Normal does not :-(

Because market research discovered that the word "Default" was "too hard"
for the majority of computer users. Wherever you see Microsoft use the name
"Normal", it usually means 'default'. There are instances where it can mean
'undefined'. The term 'default' can be misleading, because many of Word's
defaults can be specified by the user; some are true defaults built into the
code; and others can actually be left undefined.

Where Word 'requires' a value (the default font Times New Roman is an
example: Word can't have text that has 'no font', otherwise it wouldn't be
text) it must force that property to always have a value. In those cases,
there is a hard-coded default in the executable. However, a user can set
the font for the Normal style to be whatever they wish. In some cases (e.g.
Custom Dictionary language...) Word functions just as well with no value, so
the default value is "Undefined".
If I have a paragraph of style "xyzzy" and I "clear its
formatting" with the Edit->Clear->Clear Formatting directive, the
style of the paragraph changes to Normal. Actually, it doesn't
really CHANGE to normal but rather the removal of the "xyzzy"
format set (i.e. "style") simply re-exposes the paragraph to the
"no style" CONDITION which uses the base formatting called
Normal.

That's not quite correct. Normal style IS a style... The paragraph still
has a pointer into the style table, it's just that the pointer is set to '0'
which picks up the first line of the style table -- Normal style.
This means that all other styles simply override the base
formatting called Normal. Normal is referred to as a style even
though applying it to a paragraph with a different style doesn't
override or replace the style as much as it just plain deletes it.

Not so: It replaces the value of the style pointer that may have been e.g.
'123' with a value of '0'. A 'Default' document has about 40 entries in the
style table: some of these are true "Default" styles (i.e. They always exist
and always have values and cannot be deleted) while others are "Built-in"
styles. Built-in styles are reserved names: the styles may not exist, but
the names are reserved. Word will 'instantiate' (i.e. Physically create
them) if they are used. Until they are used, their names are reserved: if
you try to create a style of that name you will get an error saying the name
is already in use, but they have no properties so they do not actually exist
yet.
Ok, So I'm seeing now that this is the mechanism that Word uses
to deal with the fact that any empty document must have at least
one (empty) paragraph in it. Since any paragraph that exists must
have a style, Normal is it. I would then presume that for this
reason the Normal "style" cannot ever be deleted from a document.

That's correct. There are a few styles that can never be deleted: the
Heading series, Normal, some of the List series, and one or two others.
These styles must exist, because if Word ever creates the structures that
use them, it must be able to assume they are there. An example is "Header"
and "Footer" styles. A default document has neither headers nor footers.
However, the moment you add either, Word populates each with a default blank
paragraph, and that paragraph has the default style Header or Footer as
appropriate.

Hope this helps

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 
J

Jeff Wiseman

John said:
Hi Jeff:




Yes: But you have to use the Customise facility to place the ResetChar and
ResetPara commands on your favourite menu. The commands already appear in
the All Commands list, you simply have to assign them to a menu.


This sounds like an INCREDIBLY useful pair of buttons to have on
my custom toolbar! From everything else that's been described
here, importing paragraphs of a given style from other documents
that you want to make sure match those in the destination
document absolutely must have these operations in order to be
guaranteed consistent it would seem.

When "applying a style" to a "selection", a series of complex rules are
followed. They used to document them, but they have become so horrendously
complex that I think they have given up.


That's because they really don't understand it themselves.

<wonderful description of MS's pathetically complex formatting
algorithm deleted>

How's this for an algorithm...

"The only way to change the format settings of the Style is to
select the style itself. Selecting all the text in the entire
paragraph will only result in character level formatting for all
the characters that were selected."

Oh yea, I forgot, although MS CLAIMS to do things object
oriented, they have provided no way to explicitly deal with the
Style or Paragraph entities (we went through this one last
year...remember the discussions about tripping over the paragraph
format tokens that can be treated as characters themselves...) so
they have to guess at what the user is trying to do instead of
simply letting them do it themselves.

Grrr...

It would be helpful at this point if someone with no need for a life would
sit down and carefully test the thousands of cases required to prove whether
what I say above is all true. What we're talking about here is Word's
"Smart Cut and Paste" algorithm. Like I say, Microsoft appears to have
ceased to document it, and that's probably because the mechanics are now so
complex that only a computer could figure out what is going to happen. If
you can figure it out, good luck to you...


Yes, good luck because I would bet good money that they would
discover a boatload of bugs and inconsistencies in how it worked
in reality.

A scrambled user interface will always reveal such things since
you cannot put a highly structured interface on a scrambled
infrastructure--in general it just can't be done.

That's not quite correct. Normal style IS a style... The paragraph still
has a pointer into the style table, it's just that the pointer is set to '0'
which picks up the first line of the style table -- Normal style.




Not so: It replaces the value of the style pointer that may have been e.g.
'123' with a value of '0'. A 'Default' document has about 40 entries in the
style table: some of these are true "Default" styles (i.e. They always exist
and always have values and cannot be deleted) while others are "Built-in"
styles. Built-in styles are reserved names: the styles may not exist, but
the names are reserved. Word will 'instantiate' (i.e. Physically create
them) if they are used. Until they are used, their names are reserved: if
you try to create a style of that name you will get an error saying the name
is already in use, but they have no properties so they do not actually exist
yet.


Sorry but I was waxing phylosophical on those last two points :)

Yes, a Style is a collection of formatting rules so Normal is a
style. The point I was smugley trying to point out was that as
usual, just calling it a Style desn't make it behave in a
consistent fashion with other Styles unless you look at a subset
of its behaviors. In the "object world" the entire entity must
have the same attribute and method types. MS's Styles do not.

Hope this helps


Yep, it has (and I even got to vent some too :) Your ResetChar
and ResetPara button suggestion may be the best I find this year...

Thanks!
 

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