Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Styles (Word 2000)

    When doing an Insert, File operation, is it possible to avoid having the styles in the inserted document modified by the existing styles in the receiving document?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Styles (Word 2000)

    Welcome to Woody's Lounge!

    As far as I know, only by giving the styles in the inserted document different names than the styles in the receving document.

  3. #3
    New Lounger
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Styles (Word 2000)

    Thank you, Hans, for the prompt response.

    Yes, I've tried that and it works well with two exceptions.

    1. The person submitting the file to be inserted uses Word's built in styles which we can't remove, and/or bases styles on Normal and the receiving document's Normal has different attributes.

    I really don't think that there is an answer for this one, but I thought it was worth a try.

    Thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Styles (Word 2000)

    You could create copies of the built-in styles, and use those instead. But I admit that is very tedious.

  5. #5
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Styles (Word 2000)

    One way to achieve that is by saving the inserted file as RTF, and renaming all styles in the RTF header (say by appending some rarely used character).
    After you inserted the RTF file, you can delete it.

    These steps could be automated with a macro.

    Something like that could be done using HTML or XML, too, if you are more familiar with those formats.

    With Word2003 and XML, or older versions of Word and HTML, you might not need to actually save the inserted file. You should be able to open it and access the "source" with
    ActiveDocument.Content.XML
    or
    ActiveDocument.HTMLProject.HTMLProjectItems(1).Tex t
    respectively, then insert that.
    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  6. #6
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    USA
    Posts
    223
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Styles (Word 2000)

    This is a great solution! Can you tell us how to easily find the styles in the rtf file? More specifically, can you give us some idea of how to do this with Excel VBA code? Since the lines of text appear to be of varying length in the .rtf file, what can we use to edit the file from a macro?

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Styles (Word 2000)

    RTF makes strange reading, but as it appears to be mostly plain/encoded text, you should be able to use VB and the Scripting Library's file access and RegEx objects to hack it.

    Regarding the format, you might try the book recommended in <post#=473417>post 473417</post#> as one way to get a handle on the RTF format. (I browsed it at the store but haven't actually used it.) Speaking of Andrew77, chapter 41 from his Word Hacks book is available as a sample here, and it shows how Author names for tracked changes are exposed in RTF and gives a Perl script to hack them. Okay, it's a foreign language compared with VB, but you get the idea. <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

  8. #8
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    USA
    Posts
    223
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Styles (Word 2000)

    Thanks for the reply! This will take some time to digest but it sure looks helpful! Thanks.

  9. #9
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Styles (Word 2000)

    In RTF, the styles are in the stylesheet element.
    A while ago I've posted a pretty simple macro in the newsgroups, which uses a wildcard replacement. Since you have to save the Word file in RTF, it needs Word though.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

Posting Permissions

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