Re: Fighting with templates (again) -- using John McGhie's "LabelStyles" and "RestoreStyles" macros

From: Hank Roberts (hank_at_spamcop.net)
Date: 03/11/04


Date: 11 Mar 2004 11:08:03 -0800


"Margaret Aldis" <Margaret.Aldis@mvps.(SpamStopper)org.invalid> wrote in message news:<O0LQrEGAEHA.3220@TK2MSFTNGP10.phx.gbl>...
...
> need to paste text into a fresh document shell - via some 'cleaned out' form
> (some people simply strip all the formatting out completely, but you can
> often find semi-automatic ways of making use of what tagging and formatting
> is already there provided you go via a 'quarantine' document).

Hi Margaret,

I'm back (formerly known as 'hank@netcom.com') and again wrestling
Word (2000 SR-2 here now).

I've seen references to saving through HTML and back fixing the
accumulated corruption, but haven't gotten it to work for the files my
employer puts in front of me (we have been accumulating cut-and-pasted
formatting since the switch from VMS Mass-11 to Word 3.1, so there's a
bit of corruption in the background environment, ahem.)

You mention ways of making use of tags; in catching up I've posted
this in some other followups but this seems the best thread -- my
successes so far have come from using John McGhie's old "LabelStyles"
and "RestoreStyles" macros, the first one reading the Style name and
pasting it in angle brackets at the front of each paragraph; the
latter reading the ASCII file and applying Styles according to what it
finds in angle brackets.

When used a few years ago -- to leave corruption behind, before the
Char Char Char feature -- the intervening step was simply saving to
ASCII, closing, reopening, and running RestoreStyles.

Now with the Char Char corrupted styles, on our setup we simply can't
get rid of them -- Heading 4,Heading 4 Char, Char, Char blocks any
attempt to rename it, or to overwrite it with the stock Heading 4, for
example.

I remembered the Label and Restore tricks and thought to take the<
ASCII file, remove the <corrupt Style name> strings and replace them
with <good Style name> strings, while the file is in ASCII -- then let
ReplaceStyles put in the proper Styles when the doc is changed back to
Word. It does work.

Now, I find when I save to ASCII, then search out all the strings with
garbled Style names and replace them with the stock NORMAL Style names
-- this does work. It requires creating a plain vanilla document, and
manually putting in under the stock Style names the formatting the
user wanted to see that had gotten put into the Char Char Char
definitions.

That means taking the corrupt original and doing Print/Print Styles,
and hand copying those definitions into the new vanilla doc, under
standard names for Styles (based on No Style, not based on Normal, for
safety later on).

Then, John's RestoreStyles macro looks in the angle brackets, finds
where I substituted "<Heading 1>" in place of "<Heading 1
Char,Heading1 Char Char>"
and applies the Heading 1 style.

It does recreate the desired formatting -- assuming I've hand-defined
under Heading 1 the formatting the author had in under the corrupt
name -- paragraph by paragraph, and will rip through a 270 page Word
document in a couple of minutes, and it will look like it's supposed
to while having only good Styles.

(When the macro hangs, 'Debug' shows the problem (always means I
forgot to search/replace out one of the corrupt style names from the
ASCII file), which I can usually do on the fly and resume the macro
running).

I haven't seen John's macros published at the MVPS site; is something
like this already set up for people to use? Someone (not I) competent
with macros might be able to find a way to pull out more of this that
I'm doing by hand.

---> I've tossed this in just before going offline for a period of at
least three days, maybe a couple of weeks, in haste; hope it makes
enough sense to follow, and I'll check back as soon as I can. -- Hank
Roberts



Relevant Pages

  • Re: Fighting with templates (again) -- using John McGhies "LabelStyles" and "RestoreS
    ... > often find semi-automatic ways of making use of what tagging and formatting ... Char Char Char feature -- the intervening step was simply saving to ... ASCII file, remove the strings and replace them ... That means taking the corrupt original and doing Print/Print Styles, ...
    (microsoft.public.word.pagelayout)
  • Re: Word2003, references endnote separator
    ... Word has been known to handle up to 10,000 pages in a single file, assuming ... try the standard corrupt doc fix: ... formatting and page layout is preserved. ... separator and endnote continuation notice. ...
    (microsoft.public.word.docmanagement)
  • Re: Word2003, references endnote separator
    ... Fortunately my computer is decent and handles my 200 ... "Daiya Mitchell" wrote: ... try the standard corrupt doc fix: ... formatting and page layout is preserved. ...
    (microsoft.public.word.docmanagement)
  • Re: macro to find style "Main Body Text Char *" and replaced it
    ... It works to the point that Main Text Char etc is converted to Normal. ... > 'Save any paragraph where the Normal style is applied ... Font formatting will be preserved. ... then reapplying the manual formatting. ...
    (microsoft.public.word.vba.beginners)
  • Re: How can I validate a Word document to find out if it is corrupt?
    ... If Word can open the file and Doc2Help is working via a Word interface then ... question 'what on earth does "corrupt" mean?' ... known as "OLE structured storage". ... and the formatting is stored separately from the text. ...
    (microsoft.public.word.docmanagement)