RTF documents as templates

Jan Schenkel janschenkel at yahoo.com
Mon Feb 21 08:03:00 EST 2011


--- On Mon, 2/21/11, SparkOut <SparkOutYNY at gmail.com> wrote:
> 
> If you use MS Word to produce a template file that contains
> your
> [[Placeholders]] then there is a distinct problem with
> formatting. I believe
> Jan's very own advice in one of the "Merge" newsletter
> articles was always
> to "Save As" to as to force MS Word to write a completely
> new document out.
> I'm not sure if that is always successful. MS Wordpad which
> comes as
> standard on every Windows PC produces much cleaner rtf
> files.
> 
> I know from experience that MS WOrd can can mangle the
> formatting internally
> so you get [[garbage{mangled rtf rubbish
> formatting}place{stuffinserted}holders]] that are unusable
> for a merge.
> 
> However, I have also just revisted the merge function for a
> project I have
> on the go, and now I too find that where a Placeholder
> variable for merging
> is empty, the [[Placeholder]] in the rtf document is not
> empty - the square
> brackets are stripped, but the Placeholder name is left.
> 
> So if my variables are: tName (containing "Mr Smith") and
> tAddress1
> (containing "25 Some Street") and tAddress2 (which is
> empty) and tCity
> (containing "London") 
> 
> and if the rtf document contains:
> 
> [[tName]], [[tAddress1]] [[tAddress2]] [[tCity]] then the
> output is:
> Mr Smith, 25 Some Street tAddress2 London
> 
> How can I suppress the empty output in the placeholder
> fields?
> (Ideally I would like to consider a mail-merge type blank
> line suppression
> too, but I would really settle just for being able to merge
> to empty
> placeholder tags.)
> 

Did you declare the variable first using the 'local' command?
By definition, if the engine encounters what looks like a variable name that hasn't been declared, it assumes you want a variable 'tAddress2' with content "tAddress2"

Jan Schenkel.
=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)



      




More information about the use-livecode mailing list