Not your usual "char char" problem

L

Larry

Cross-posted from microsoft.public.word.mac:
=====================================

This isn't the regular "where did this mystery character style come
from" problem that we usually associate with Evil Hidden Char styles.
This one's a doozy, and it's affecting two distinct and unconnected
groups within my international company. Here's the scenario:

User Amy creates a document in Mac Word 2004, using a templated set of
paragraph and character styles only -- no local formatting, no
monkeying with the styles as given, and certainly no renaming of
styles. Amy sends me the document to check. I open it in Win Word
2003, and see that Amy has done a great job of obeying the style usage
rules -- except that one of the most commonly used paragraph style
names (possibly THE most commonly used?) -- has been changed to "Char
Char". It's not a character style, and it doesn't have a leading space
in the name; it's just a paragraph style that used to be "READ_PARA",
but is now named "Char Char". Amy swears that she did not change the
style name, and, in fact, while on the phone with me and looking at
the file on her Mac, says, "What are you talking about? It says
"READ_PARA".

Meanwhile (I've just learned), User Bill is engaged in the same
conversation with my colleague, Techie Carla, who works in a
completely separate (physically and functionally) organisation. Amy
and Bill have no connection whatever to one another. Bill is using Mac
Word 2008, but otherwise the symptoms are the same. Oh, except that in
Bill's document, it's style "04BaseText" that is changing to "Char
Char"... and "04BaseText" is, according to Carla, supposed to be the
most commonly used style in Bill's document.

This problem is repeatable; even though Carla and I fix the files of
our respective users and send them back, when we receive updated
versions, we again see that "READ_PARA" (in my case) and
"04BaseText" (in Carla's case) have been changed to "Char Char" in our
Win Word 2003 sessions, while Amy and Bill both insist that no such
change is visible on their screens. Amy and Bill also swear that only
colleagues who have similar editing environments to theirs have ever
touched their files.

Carla and I have never seen anything like this before. Any insights,
anyone?

UPDATE: And now we have freelance user Edgar, working with my
organisation but on a completely different project, having the same
problem as Amy (in my organisation) and Bill (in the other one) were.
Except that it's not style name "READ_PARA" or "04BaseText" that gets
munged, it's style name "STX", which, in Edgar's file, is the most
commonly-used style. Edgar has no relation whatever to Amy or Bill.
 
J

Jay Freedman

Hi Larry,

It may not be the 'usual "char char" problem', given the Mac involvement and
the complete replacement of the style name, but I'll bet that the cause is
the same: The users are selecting some but not all of a paragraph,
especially not including the paragraph mark, and applying a paragraph style.
That's generating a linked style.

The solution is probably the same, too:
http://homepage.swissonline.ch/cindymeister/MyFavTip.htm#CharStyl

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
L

Larry

Hi Larry,

It may not be the 'usual "char char" problem', given the Mac involvement and
the complete replacement of the style name, but I'll bet that the cause is
the same: The users are selecting some but not all of a paragraph,
especially not including the paragraph mark, and applying a paragraph style.
That's generating a linked style.

The solution is probably the same, too:http://homepage.swissonline.ch/cindymeister/MyFavTip.htm#CharStyl

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroupso
all may benefit.



- Show quoted text -

But Jay, the Char Char style isn't a character style. It's a perfectly
normal non-linked paragraph style. It just has the wrong name, as if
the user had simply opted to rename it to "Char Char". Except that it
doesn't have that name when the Mac user looks at it, just when the
Word 2003 user looks at it.
--larry
 
T

Terry Farrell

Maybe one user doesn't have Keep Track of Formatting enabled?

Terry Farrell

Hi Larry,

It may not be the 'usual "char char" problem', given the Mac involvement
and
the complete replacement of the style name, but I'll bet that the cause is
the same: The users are selecting some but not all of a paragraph,
especially not including the paragraph mark, and applying a paragraph
style.
That's generating a linked style.

The solution is probably the same,
too:http://homepage.swissonline.ch/cindymeister/MyFavTip.htm#CharStyl

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.



- Show quoted text -

But Jay, the Char Char style isn't a character style. It's a perfectly
normal non-linked paragraph style. It just has the wrong name, as if
the user had simply opted to rename it to "Char Char". Except that it
doesn't have that name when the Mac user looks at it, just when the
Word 2003 user looks at it.
--larry
 
K

Klaus Linke

Jay Freedman said:
It may not be the 'usual "char char" problem', given the Mac involvement
and the complete replacement of the style name, but I'll bet that the
cause is the same: The users are selecting some but not all of a
paragraph, especially not including the paragraph mark, and applying a
paragraph style. That's generating a linked style.

That's not the whole story, though. What you describe is creating a char
character style.

Only once this character style exists, Word goes completely bonkers, and
creates a new " Char Char" paragraph style.
I thought the bugs leading to them have been fixed if you apply the latest
updates.

Not sure whether there's a specific thing that causes them... My impression
is that exchanging Word docs between different Word versions may well be
enough to create them, probably with the (unavoidable) Char styles being a
requisite condition.

That macro is meant for genuine "Char" character styles...

The "Char Char" paragraph styles come in different flavours. If they have
the name of some paragraph style and "Char Char" appended, it's probably
easy enough to replace them:
Really obnoxious is the " Char Char" style: Note the leading space. Since
style names aren't allowed to start with a space, Word (Find/Replace, VBA)
has a terrible time dealing with it.
Somebody in these groups found out the leading space is removed by saving in
XML format. After that has happened, you can deal with it -- say replace it
with the original style.

And then there may be " Char Char Char" character styles and " Char Char
Char Char" paragraph styles...
Plus, the "Char" is specific to English. I've seen " Car Char Char Zchn" and
other misbegotten bastards in international settings.

Regard,
Klaus
 
L

Larry

Only once this character style exists, Word goes completely bonkers, and
creates a new " Char Char" paragraph style.
I thought the bugs leading to them have been fixed if you apply the latest
updates.

One thing I should do is try to ascertain whether the Mac users, who
are all remote (freelance) users, have applied the latest patches, if
any.
Not sure whether there's a specific thing that causes them... My impression
is that exchanging Word docs between different Word versions may well be
enough to create them, probably with the (unavoidable) Char styles being a
requisite condition.

You may be onto something there, Klaus (as usual). If the users,
despite their protestations, are doing something to create a Char
style, and that then causes a usually-dormant bug to manifest when
documents are transferred from one version to another... although I'd
like to know WHY this is happening, I'd settle for being able to
prevent it or at least fix it automatically. A difficulty with an
automatic fix, though, is that the Char Char paragraph style is a
replacement name for some legitimate style name... but which style
name that is seems to depend on which one is used most in the
document. In one document, it might be style XYZ; in the next, style
ABC. I would need some way of encoding the most commonly used style in
a document variable, say, just before the Mac user saves the document.
Then, when I open it in Windows and discover the style name swap, a
program could query the document variable and restore the proper style
name.
Really obnoxious is the " Char Char" style: Note the leading space. Since
style names aren't allowed to start with a space, Word (Find/Replace, VBA)
has a terrible time dealing with it.
Somebody in these groups found out the leading space is removed by savingin
XML format.

That was me. ;-)

It's also possible, in the Formatting and Styles pane, to go to
Customize => Styles => Organize and find such styles at the top of the
list, where they can be deleted, or renamed to something that can then
be inspected.

I still have, and offer to others, a powerful Char-style cleaner macro
that handles everything except the leading-space styles. The macro
will apply the intended paragraph style wherever the Char-style
occurs. The code was originally lifted from some of your work, Klaus,
but has been heavily modified since then.
And then there may be " Char Char Char" character styles and " Char Char
Char Char" paragraph styles...
Plus, the "Char" is specific to English. I've seen " Car Char Char Zchn" and
other misbegotten bastards in international settings.

Who wants to get a posse together?! We leave for Redmond at dawn!

---larry
 
K

Klaus Linke

Hi Larry,
That was me. ;-)

You should get a medal for that! Maybe the "Don't Panic" button that came
with "The Hichhiker's Guide to the Galaxy", which still should be around in
one of my drawers?

It's also possible, in the Formatting and Styles pane, to go to
Customize => Styles => Organize and find such styles at the top
of the list, where they can be deleted, or renamed to something
that can then be inspected.

I dimly remembered you'd found another way. Hope I'll keep it in mind now.

I still have, and offer to others, a powerful Char-style cleaner
macro that handles everything except the leading-space styles.
The macro will apply the intended paragraph style wherever the
Char-style occurs. The code was originally lifted from some of
your work, Klaus, but has been heavily modified since then.

Maybe it should be put into the public somewhere? The MVPs might post it on
word.mvps.org ...
If you mail me the code, I'd be happy to look it over. I've been a bit
hesitant to publish something along those lines, because it's easy to
accidentally clobber formatting in the process. Also because none of that
stuff is documented -- so it seems to be a bit risky to play with linking or
unlinking styles without quite knowing what one is doing. And finally
because I have no good idea of all the kinds of weird Char style issues and
weird linking and bugs/corruption exist in "real world" documents, and what
different Word versions do themselves to fix that mess, or to hide it under
the rug.

Regards,
Klaus
 
L

Larry

Klaus, I tried to send the macro below directly to you, but there is
some problem with the Reply to author function.

You'll notice that it doesn't try to account for international
language variation for "Char" -- as an amateur linguist, I am
appropriately embarrassed by this.

Latest news today: I am able to duplicate the error. All I have to do
is open a WinWord document on my Mac and make any change, no matter
how minor. When I next open the document in WinWord, one paragraph
style will have been renamed " Char Char". But my latest testing does
not change the most-used style; rather, it picks on the alphabetically-
last style. More testing to come.

I'm proud to be the recipient of the prestigious "Don't Panic" medal!
It will be the second in my collection. :)

Cheers --
---larry

''''''''''''''''''''''''''''''''''''''''''

Sub DeleteAutoCharStyles()
' Larry Sulky
Dim myStyle As Style
Dim myStyleLinkStyle As Style
Dim myLog As String
Dim myCheckStyleName As String
myLog = ""
For Each myStyle In ActiveDocument.Styles

If myStyle.Type = wdStyleTypeCharacter And _
myStyle.LinkStyle <> ActiveDocument.Styles
(wdStyleNormal) Then
Set myStyleLinkStyle = myStyle.LinkStyle
myStyle.LinkStyle = ActiveDocument.Styles(wdStyleNormal)
myStyleLinkStyle.LinkStyle = ActiveDocument.Styles
(wdStyleNormal)
End If

If (myStyle.BuiltIn = False) And (Right(myStyle.NameLocal, 5)
= " Char") Then
Dim realStyleName As String
realStyleName = myStyle.NameLocal
While Right(realStyleName, 5) = " Char"
realStyleName = left(realStyleName, Len(realStyleName)
- 5)
'MsgBox realStyleName, , "DEBUG"
Wend

On Error Resume Next
ActiveDocument.Styles.Add (realStyleName)
' If the base style no longer exists, then we need
to force
' it so the rest of the processing can continue.
' A rare and pathological situation.
On Error GoTo 0
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Style = ActiveDocument.Styles(myStyle.NameLocal)
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles
(realStyleName)
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

myLog = myLog & myStyle.NameLocal & vbCrLf
myStyle.Delete
End If
Next
Bye:
If (myLog <> "") Then
MsgBox myLog, , "Deleted these bogus character styles:"
Else
MsgBox "No bogus character styles found.", , "Done!"
End If
End Sub
 
K

Klaus Linke

Thank you for the macro.
I currently use my real email addy here -- No idea why it didn't work.
(e-mail address removed) should work too, though I only check that account
irregularly.
[...] When I next open the document in WinWord, one paragraph
style will have been renamed " Char Char".

You've probably looked what that " Char Char" style's .BaseStyle, and what's
its .LinkStyle is...
I take it there's no hint from that, about which style it was originally?
I'm proud to be the recipient of the prestigious "Don't Panic" medal!
It will be the second in my collection. :)

You're very welcome!
Klaus
 
L

Larry

You've probably looked what that " Char Char" style's .BaseStyle, and what's
its .LinkStyle is...
I take it there's no hint from that, about which style it was originally?

Basestyle is "no style", and there is no link style. Style for
following paragraph is " Char Char".

I passed the sample documents to your other email address, Klaus.

Latest testing news... I've tried to narrow in on why this behaviour
happens with one particular style in a file and not another. It's not
by usage count, it's not by alphabet, nor recency of creation. It's
unlreated to the presence of any local character formatting. I'll keep
hunting. --larry
 

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