Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    My ideas on Evil Word Char Char Styles (2002)

    I call them Frankenstyles

  2. #2
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Christie,

    FWIW:

    This is very interesting. I've been wrestling with this Char char char madness for some time now in templates I created that insert auto text. I posted about this in another thread and the moderator directed me to your post.

    I had just discovered that (somehow) this char char style had gotten on my Body Text style in a global template. This template file is very large and contains a lot of macros and forms. INTERESTINGLY -- when I would edit the template and save it, it would take, literally, 15-20 seconds to save sometimes.

    After reading your post, I went into the organizer and deleted the body text style which WAS of type paragraph AND character! (I had NEVER noticed that), and then redefined Body Text as I wanted it.

    The template now saves as fast as any other document, and is almost 1/2 mg. smaller in size.

  3. #3
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Your post was also very helpful. (Although I can't quite bring myself to refer to it as something so benign sounding as a "dancing style!")

    I know I first got into trouble with these with a template I created that held several auto text entries, and it was when the auto text entries were inserted back into the document that the Char Char styles reared their ugly heads. I too never apply local formatting -- but I was creating the auto text based on text/tables set up by someone else who might not have known that apply a paragraph style to part of a paragraph results in character formatting.

    What really threw me about this is that the Body Text, Char Char Char style appeared in the styles and formatting task pane after I inserted the auto text, but when I moved through the auto text I couldn't FIND the style applied anywhere.

    Arrrggg! But now I understand much better what's going on and will give your code a whirl. Thanks!

    Laura

  4. #4
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi Andrew,

    Thanks for the tips on reproducing the problem in 2002 only documents

  5. #5
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi Laura,

    Thanks for that info and link -- I wasn't aware of the google forum, but that's now added to my favorites for when I have to research the various and sundry Word problems that always find their way to me for resolution.

    That is interesting about the service packs minimizing the problem, I wonder if that just prevents the styles from bugging out within 2002, as in the AutoText and Clipboard issue Andrew described. When I get a chance, I will re-test taking a 2002 document with linked styles into a lower version of Word for editing and return to 2002, since I have all the SPs and patches installed (can you say overzealous?). <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

    Christie

  6. #6
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    Hi,

    I read on another forum ( http://groups.google.com/groups?selm=eNGpP...FTNGP11.phx.gbl ) that the service packs greatly reduce this problem.

    Maybe you have a more recent service pack so yours is behaving better.
    Myself, I'd yet to install the service pack, but will do so now!

    Laura

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Christie

    Have you tried it with the offending text inside a table cell? That is where I originally saw it and how I tested it when I posted the instructions. I deleted the fact that my text was inside a table cell because Terri didn't mention it as a factor. When I first came across the problem, the users were using tables stored as autotext and each time they added a table, the style name grew longer. This quickly reached the limit and a phantom one was created so the pattern could continue but Word was incapable of displaying the phantom style by itself.

    A complicating factor with that client was that table styles (also new in Word 2002) were overriding the paragraph styles and the table styles applied themselves without the users actually applying them directly. This meant that paragraph text inside a table was formatted differently from the same styled text outside the table even though there was no local formatting on either location (verified by Ctrl-Q and Ctrl-Space).

    My Word version is 2002 (10.5522.4219) SP-2. What version do you have running?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Andrew --

    This is EXACTLY what I was doing -- putting tables in auto text (w/ bookmarks and text inside of them) and then inserting them (w/ vba code) into the document. I applied the tableNormal style to the table, but had to modify a border or two.

    I lost HOURS watching word crash when I tried to redefine auto text, and trying to "start over from scratch" to avoid the evil styles.

    MADNESS!!!
    Laura

  9. #9
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi,

    Myself, I'm always reluctant to install service packs because I'm afraid they'll introduce more problems than they solve! (Can you say paranoid?!) <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>

  10. #10
    New Lounger
    Join Date
    Nov 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi Christie,

    I wanted to ask -- you mentioned using the organizer to copy in the correct style -- this is what I've been doing programmatically (and sometimes manually). One thing I noticed though is that this does NOT change the style type back to PARAGRAPH, it remains a PARAGRAPH AND CHARACTER style. (Same with Andrew's code to trip the aliases) Do you think this is anything to be concerned about?

    The documents are behaving, but that "paragraph AND character" style type is REALLY bugging me -- now that I know it exists...

    Thanks
    Laura

  11. #11
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi Andrew,

    I finally got a chance to test this some more, but I still don't get the automatic compounding of styles. I tried it with the text in a table, making autotext entries, and cutting/copying with the clipboard. You and I are running the same version of Word, I am on Windows XP. I sure wish I could recreate this and see it for myself, sigh! Interesting about the table styles, too -- I have not seen them automatically apply themselves. Was the client having all these problems running any custom templates and macros that may have triggered unusual behavior?

    Christie

  12. #12
    Lounger
    Join Date
    Nov 2001
    Location
    SF Bay Area
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: My ideas on Evil Word Char Char Styles (2002)

    Hi Laura,

    Interesting -- I hadn't encountered that since all the "frankenstyle" documents I have dealt with have gotten that way from being edited in previous versions of Word, so the style linking is gone.

    I would think your documents would be fine as long as the triggers for creating the problem styles don't occur -- text formatted with the char style being edited in a previous Word version, or the issue with autotext in tables or used with the clipboard (which I can't reproduce, no matter how hard I try). I did find that deleting the char style from the organizer will break the link, although I get an error message that it can't be deleted, but when I check the task pane the linking is gone, and returning to the organizer the char style is no longer listed. So if it really bugs you to have them there, it looks like deleting the the char styles would do the trick.

    I haven't worked with VBA code on this issue, but check out <!post=Mesaka's post,316457>Mesaka's post<!/post> in a similar thread, although you have probably already read it. <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

    Christie

  13. #13
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Macro to Delete all Style Aliases (2002)

    I will add a few of my random thoughts ...

    I prefer to call them Dancing Styles (as in Slide Slide Char Char Char). They can grow larger than a style name allows (256 characters I think) which will then give a funny result that a second hidden style with the same name gets created but can't be seen in anything other than a RTF file. If you delete a style with a hidden one behind it, the hidden one can then be seen, which makes it appear that the delete didn't happen. If you delete the second one then it really gets deleted.

    I can also demonstrate a couple of ways to create a dancing style (frankenstyle) without leaving Word 2002.
    Select a part of a paragraph within a table and apply another paragraph style (eg Heading 1)
    Add the table as a new autotext entry
    Insert the autotext entry back into the file
    That gives me a "Heading 1, Heading 1 Char" style
    In a previous thread Terri Gerlich (<!profile=tgerlich>tgerlich<!/profile> - <post#=259228>post 259228</post#>) also mentions using the clipboard task pane rather than an autotext entry will do the same thing.

    I can remove most of the problems once started by running a macro which removes all style aliases. This macro, whilst not originally created to resolve the dancing styles, is quite effective in reducing the problem before it goes too far. The macro looks like this
    <pre>Sub RemoveAllStyleAliases()
    Dim aStyle As Variant, iPos As Integer
    For Each aStyle In ActiveDocument.Styles
    iPos = InStr(1, aStyle, ",")
    If iPos <> 0 Then
    aStyle = Left(aStyle, iPos - 1)
    On Error Resume Next
    ActiveDocument.Styles(aStyle).NameLocal = aStyle
    On Error GoTo 0
    End If
    Next aStyle
    End Sub</pre>


    This macro should not be used if you are at all attached to other style aliases. A macro has now been posted by Gary Frieder - <post#=357927>post 357927</post#> which is more specific to resolving the char styles created as links to an existing paragraph style.

    Knowing what causes the problem, avoiding these runaway styles in the first place appears to be easy enough - never apply paragraph styles to anything less than a full paragraph (easier said than done). You should have less problems if you avoid applying local formatting where possible and primarily relying on paragraph styles for formatting.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  14. #14
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Macro to Delete all CharChar Styles (2002)

    <P ID="edit" class=small>(Edited by Gary Frieder on 15-Apr-04 12:03. )</P>Andrew,

    Thought I should post this updated version in this thread, rather than the other one I started here.

    This updated version will take care of the sample document which you sent, in which the 'Char' style names contain variants such as 'Char 1' or 'Char Char'.
    Someone else sent me a sample document with a much worse case of the 'CharChars', this revealed some other issues that a macro needs to deal with:

    Not all of the linked 'CharChar' styles created by Word are character styles; some of them can be paragraph styles. For these, the simplest approach is to just delete them. However, if they are built-in styles (such as Heading1), they cannot be deleted; in this case they need to be renamed - here is where your code to delete aliases comes in handy! (I've adapted it and converted it into a function.)

    So this now appears to get rid of all the CharChar styles; a few caveats:
    - The code searches for and gets rid of styles that have " Char" in the style name, so it would be best to use a style naming convention that avoids the use of those letters.
    - Any font formatting which was applied via the linked character style, will be lost.
    - Any alias associated with a built-in style will be lost - if that built-in style had a 'Char Char' variant in the document
    - If the document contains a very large number of styles, you may get a warning that Word is out of memory and the changes cannot be undone - just click on 'Yes' and allow it to continue (the test document I tried it on, had 240 styles).

    I'd be very interested if anyone else gets a chance to test this macro out - if any additional issues need to be accounted for, let us know.

    Gary

    <pre>Public Sub RemoveAllCharCharStyles2()
    'Gary Frieder 2004

    Dim objDocStyles As Styles
    Dim objTempStyle As Style
    Dim StylesCt As Long
    Dim strStyleName As String
    Dim c As Long
    Dim p As Long

    Set objDocStyles = ActiveDocument.Styles
    StylesCt = objDocStyles.Count

    'First pass - get rid of linked character styles:
    For c = StylesCt To 1 Step -1
    If objDocStyles©.Type = wdStyleTypeCharacter Then
    strStyleName = objDocStyles©.NameLocal
    If InStr(1, strStyleName, " Char") <> 0 Then
    Set objTempStyle = objDocStyles.Add(Name:="zTempStyle")
    objDocStyles(strStyleName).LinkStyle = objTempStyle
    objTempStyle.Delete
    Set objTempStyle = Nothing
    End If
    End If
    Next 'n

    'Second pass - delete remnant linked paragraph styles with "Char" in name -
    'However, built-in styles can't be deleted, these must be renamed:
    'Number of styles in document has changed:
    StylesCt = objDocStyles.Count
    For p = StylesCt To 1 Step -1
    If objDocStyles(p).Type = wdStyleTypeParagraph Then
    strStyleName = objDocStyles(p).NameLocal
    If InStr(1, strStyleName, " Char") <> 0 Then
    If objDocStyles(p).BuiltIn = False Then
    objDocStyles(p).Delete
    Else 'it's a built-in style, need to rename it instead:
    'how to rename it? - use code to get rid of aliases:
    objDocStyles(p).NameLocal = strGetStyleNameMinusAliases(strStyleName)
    End If
    End If
    End If
    Next 'n

    Set objDocStyles = Nothing

    End Sub

    Public Function strGetStyleNameMinusAliases(ByVal StyleName As String) As String

    'Adapted from code by Andrew Lockton:
    Dim iPos As Long

    iPos = InStr(1, StyleName, ",")
    If iPos <> 0 Then
    StyleName = Left$(StyleName, iPos - 1)
    End If

    strGetStyleNameMinusAliases = StyleName

    End Function</pre>

    Credits/Reference:
    The kernel for the above code was adapted from a macro posted by Cindy Meister here. Her original code was this:

    <pre>Sub DeleteHeading2Char()
    Dim styl As Word.Style, doc As Word.Document
    Set doc = ActiveDocument
    Set styl = doc.Styles.Add(Name:="Style1")
    On Error Resume Next
    doc.Styles("Heading 2 Char").LinkStyle = styl
    styl.Delete
    End Sub
    </pre>

    The code for stripping aliases from style names is adapted from code posted by Andrew Lockton earlier in this thread.

    A very good discussion of the hybrid linked character styles problem can be found in this white paper by Microsystems.

  15. #15
    Star Lounger
    Join Date
    Jan 2003
    Location
    San Francisco, California, USA
    Posts
    93
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Macro to Delete all CharChar Styles (2002)

    Hi Gary,

    This a great macro and I intend to try it out on documents created outside our authoring environment. This white paper from Microsystems is also an excellent reference. I am surprised that no one has mentioned (even Microsystems' white paper) that "keep track of formatting" is the culprit for this problem. Is this not the case?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •