Results 1 to 10 of 10
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    MERGEFORMAT and CHARFORMAT with {IncludeText}

    Some things I learned while playing with {IncludeText} in Word97SR2 (WINWORD EXE 5,337,088 06-01-98 12:00A WINWORD.EXE). My comments may contain errors, use at your own risk but please notify me of any errors or supply me with re-phrasing; I'll respond to your riposte and re-post corrections promptly.

    What is written here may well apply to any merged text; I happened to be using the {IncludeText} field, so I wrote about what I saw. Further, I deleted my Normal.dot and had Word create a fresh copy before running these tests. I am supplying a copy of this Normal.dot in the accompanying PKZip25 file.

    This document (C:TempHost.doc) contains a few macros and a Toolbar "Host". The toolbar button "YEL" toggles Yellow Local Formatting to selected text. The associated document (C:TempSource.doc) contains formatted text for inclusion. For ease of installation you can place both documents in your C:Temp folder.
    When I write "Select the first paragraph" I mean for you to select the numbered item, including any embedded paragraph marks. Thus, from "3. {IncludeText}" all the way to the next "{end of included text}"

    A few observations.

    1. There's only MERGEFORMAT and CHARFORMAT; if you don't specify a format, MERGEFORMAT is the default if you travel the "Insert Field, Links and references, IncludeText" route, but is omitted if you travel the "Insert File, Link" route. Word97SR2 will occasionally toss in a MERGEFORMAT for free (observations 9 and 11 below), just to keep the CHARFORMAT company. I think this is a bug. You'd think that means only two options, but see Observations 11 and 12 below.

    2. Use one of MERGEFORMAT and CHARFORMAT; if one doesn't work, use the other one. I'm not kidding; sometimes the easiest way to fix a problem is to use the right tool. If you're using the wrong tool, the other one might be the right one.

    3. If neither method is satisfactory, you need to split your Source file into [search]bookmark[[/search]ed chunks and {IncludeText} each bookmarked chunk separately, repeating observations 2 and 3 until success is achieved. I have written applications that make heavy use of bookmarked chunks for insertion, but have purposely left bookmarked chunks out of this note in order to retain what is left of my sanity.

    4. "Success" will depend on a combination of what you want to govern the final appearance
    Host or Source document formatting and
    Local or Style formatting and
    Paragraph or Character formatting

    5. It is really all to do with the definition of your styles, so if styles are copied from Host to Source or from Source to Host, only local formatting can remain as your problem. Hence Rule 6

    6. Don't use local formatting. Always use styles, either Character or Paragraph. If you want to have us believe that you are done with local formatting, raise your right hand now, and in concert with your left hand, bring them both down on the keyboard and hit Ctrl-A and then Ctrl-Space. It won't do you any good, because the CHARFORMAT switch generally requires that you apply local formatting, and clearing local formatting on a global basis will negate any of your efforts to have your host document dominate the local formatting characteristic of your contributory documents. Using a character style such as Comment Reference to locally format the "I" of {IncludeText} won't do you any good either; Ctrl-Space clears that too.

    7. Decide whether Host or Source is to define the style. If I'm the one responsible for putting out the Newsletter, I like to Be In Control, so my Host document sets the rules. If, however, I'm just a minion, then I like to rest responsibility on someone else's shoulders, they should govern the formatting through their Host document.

    8. You need to be pretty dexterous with (a) updating your field application by selecting the text and tapping the F9 function key and ([img]/forums/images/smilies/cool.gif[/img] (while you are experimenting in the Host document) clearing local formatting by selecting the text and using Ctrl-space. I have supplied an Update All macro (RedEye button on the Host toolbar).

    9. Applying Format, Font and a typeface (e.g. "Stencil") to a selected {IncludeText} field re-introduces the MERGEFORMAT switch; this will cause problems to you if you had planned to use the CHARFORMAT switch. Introducing MERGEFORMAT switch where there was none can not always be considered a bug, since MERGEFORMAT is sometimes the default switch. But see Observation 1. I should have been a lawyer. The nicest thing I can say about introducing a MERGEFORMAT switch in addition to a CHARFORMAT switch is that it is an undocumented feature, since the Help files don't say what is supposed to happen when both switches are in place. The second nicest thing I can say is "It's a bug". You don't want to hear what else I've said this past weekend. I suggest that you use lower-case letters for your switches, which makes it easier to spot the MergeFormat cuckoo when it hatches. What's really weird is that a recording (Tools, Macro, record) of the change of font doesn't show any hint of MERGEFORMAT, and that my YELlow macro - s tripped down version of a recording - doesn't introduce the MERGEFORMAT switch.

    10. The Bottom Line, the proof of the pudding, is your observation of what happens in your Host document when you tap the F9 function key to update fields; after all, this is what happens when you transmit the document to another medium, whether you are Updating Fields When Printing (Tools, Options, Print, Update fields), or handing the document to another user. Always check your work by selecting all the text (Ctrl-A) and updating all fields (F9 function key). For this Host document, you can use the handy Update All macro (RedEye toolbar button on the Host toolbar ).

    11. Despite what Microsoft says, omitting a switch is not the same as including the default MERGEFORMAT. In my examples below I have an {IncludeText} field in each of three paragraphs (with "no switches", CHARFORMAT and MERGERFORMAT switches). Select the text, update with F9 and note that only the first paragraph shows RedArial, although the first paragraph has no switches and the third has MERGEFORMAT. See also Observation 1 above.

    12. Spell-checking is even more fun, and should not be performed on a heavy stomach. In my Source Document I applied No proofing as a language option to the word SourceStyle. I have just applied a character style "NoProofing" to SourceStyle in this paragraph. If you spell-check this Host document after an Update All, you will find that the spelling checker baulks on the 2nd and 3rd {IncludeText} fields, but not the first. The first example, with No Switches, has brought in the No proofing characteristics from the Source Document. Check this by selecting the string SourceStyle in each of the three {IncludeText} paragraphs and choosing Tools, Language, Set Language. Note that you will have to Update All after a spell-check to get the spell check to start again without Ignoring any previously Ignored items.
    Attached Files Attached Files

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,048
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    I have found MERGEFORMAT to be remarkably useless, causing trouble more than it helps. Generally, I use neither CHARFORMAT nor MERGEFORMAT switches. I use CHARFORMAT when I want to be sure of results.

    I haven't looked at your attachment yet.

    People may also want to look at my downloads page - IncludeText Field Tutorial.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    Charles, thanks for your response, but don't you worry too much about the attachment; it contains an elaborated view of the posting together with recommendations and sample text for anyone who wants to duplicate my experiments.

    If you are using CharFormat then you are forcing FONT characteristics (and Paragraph Border, for what it's worth) from your Host document, over-riding any font formatting characteristics of the contributing Source document.

    Your observation that MergeFormat causes more trouble than it's worth rings true with me.

    I think that the whole business of synchronising formatting between a Host and a Source document could have been better documented (than it is in the Word97SR2 help files). The only valid reason I can think of for not documenting it better is that the design and/or implementation is flawed.

    It is a great pity, because just as programmer's hype "reusable code", I think writers should be able to write "re-useable text", but whacky formatting doesn't do the good cause much good.


    I will continue to document my findings as I learn more.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    Hi Chris,

    Good observations.

    I wonder how much of your observations pertain to "merging" of text from one document to another vs the specific mechanism of using INCLUDETEXT. As you probably know, similar issues arise when you copy/paste text from one doc to another, probably if you do an Insert File, etc.

    I plan to do some experimenting over the next week and will post any applicable results. However, my purpose on experimenting with INCLUDETEXT will be focused primarily on building big documents (instead of using Master Documents) rather than the issue of what happens to the styles. I'll probably look at Charles' material also. This is for my PC Word group.

    Fred

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    > "merging" of text from one document to another

    Uh, as we say, huh.

    You have highlighted the aspect of treating the general problem as "the source of text" and "what happens to the source once it enters the host".

    My original observations (because I was creating a generalised NewsLetter with MailMerge) focussed on the second part, especially the impact of the mergeFormat and CharFormat switches of the {IncludeText}.

    It will become increasingly important to distinguish between those "problems" caused by the source text, and those arising by virtue of the mechanism used to insert that text into the final document.


    > will post any applicable results.

    Please do me a favour, and if anything you find impacts on my notes, draw it to my attention and I'll make corrections to my original attached document.



    > building big documents

    I wrote at least two templates for this purpose.

    (1)

    Document Generator
    Generation of documents from prepared text.
    Table-driven, includes automatic search-and-replace
    Users provide a document containing a series of two-column tables. The macro processes each table to produce a single new document which can be saved or edited further by the user.


    (2)

    CodeText

    CodeText can be used to generate a table of common phrases in one, or throughout several, documents.

    Its use is simple.
    Select a chunk of text - perhaps a word or two, or a common phrase, and with the text selected, run the CodeText macro.
    The macro will create a reference file codetext.doc and then start appending bookmarked text to that file. If the selected text is already resident in the file, a reference to the text is used.
    In this manner a complex and lengthy document or a suite of documents can be condensed into a series of "calls" to boilerplate text. By changing the reference text in the codetext.doc, and then selecting all of the text in the user document and tapping the F9 function key, the text fields will be updated.



    Let me know if any of this sounds interesting. Codetext can actually be turned loose unattended and collapse an entire directory structure of documents into a single (massive) reference document containing exactly unique representation of each paragraph of text.

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    Chris,

    Both of your templates seem interesting. If you can send them or a link on your site, that would help me quite a bit. Thanks.

    Fred

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    Too big to post, but you might try 20020412.zip which contains a copy o fCodeText; DocGn to follow shortly.

    I'm in the process of re-working all my templates to make better use of my utility library UGreaves.dll. This version of CodeText ought to be fairly stable. Drag the PKZIP25 file to a spare directory, unzip it, and add that template to your Globals list. Deinstallation is as simple as deleting that directory. You can delete the INI file any time - Codetext will recreate as much of it as is needed at any time.

    Phone me, reverse, if you have problems installing it.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    ... but see also Woody's OFFICE for Mere Mortals #3.08 - Linking and Embedding:

    " 1. FORMATTING EXCEL SPREADSHEETS INSIDE WORD
    A good friend of mine sent me an interesting question: "I
    put an Excel spreadsheet inside a Word document. The
    problem is that I can't figure out a way to control what
    part of the Excel sheet is displayed in the Word document.
    For example, I have an Excel sheet that contains data in 16
    cells - four wide by four high. When I put it in a Word
    document, Word displays a table of 7x10 cells. Resizing the
    linked object in the document doesn't seem to help - it
    resizes the whole table so that it still shows a 7x10 area.
    How can I limit the displayed area in Word to those 4x4
    cells that contain the actual data and "hide" the blank
    cells?"
    etc,

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    Hi Chris,

    Thanks for thinking of me. I too get Woody's Mere Mortals newsletter. Do your findings on MergeFormat etc also pertain to items from other programs? I would have thought they only pertain to other Word items.

    How is the rework on Document Generator going? My presentation is next Monday. So an older version is OK with me.

    Fred

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MERGEFORMAT and CHARFORMAT with {IncludeText} (Word97SR2)

    > Thanks for thinking of me.

    Never out of my mind (G&DR) just like all the other Loungers.


    >MergeFormat etc also pertain to items from other programs?

    I started off looking at MergeFormat, and was surprised to discover CharFormat - gee! Something else I didn't know .......

    So I wrote of MergeFormat and CharFormat with respect to {Includetext} alone - which was my need that day.


    Now, and especially in light of Woody's comments, it's turned out to be a huge field, if you'll pardon the pun (Where's Kevin Paddock when we need him?). I'd not realised that pasting a 4x4 cell array could produce a 7x16 (or whatever) thing in Word. That, on the surface, sounds much worse than "losing a bit of formatting".


    I have decided to rewrite the document generator. When I looked at my code it was re-written Wordbasic, i.e. VBA without the use of new features, such as arrays and ranges, very clumsy. I hope to have a non-robust draft version ready for email tonight. Put on your guinea-pig suit.

Posting Permissions

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