RTF documents as templates

Jan Schenkel janschenkel at yahoo.com
Mon Jun 7 17:48:25 EDT 2010


--- On Tue, 6/1/10, Robert Brenstein <rjb at robelko.com> wrote:
> On 31.05.10 at 10:50 -0700 JosepM
> apparently wrote:
> > Nop. My solution was store the entire document and
> search and replace before
> > to build the document, and then out as PDF using
> Quartam PDF Library and
> > Quartam Reports, but also you can print from a card.
> > 
> 
> If you need to just print, producing PDF files might be a
> way to go. Using RTF works as well. I used RTF documents as
> templates to produce Word docs. Basically, I created a full
> blown, properly formatted Word doc as template, then
> replaced variable elements with tokens, in my case things
> like [title], [description]. Rev stack read RTF directly
> into a variable and replaced the tokens, then saved new
> file. One needs to use RTF commands for marking new
> paragraphs, styles, and code non-English characters. I even
> used to produce Word table with varying numbers of rows by
> marking a repeating code for row in RTF and replicating it
> as many times as needed. Some sleuthing required, though, to
> decipher blocks in RTF.
> 
> Robert
> 

Sorry for the late reply - I'm just resurfacing after several months of deadlines at the day-job.

Anyway, a while ago I wrote two articles for the revUp newsletter, titled 'The Word of Merge':
- part 1: <http://runrev.com/newsletter/november/issue61/newsletter3.php>
- part 2: <http://www.runrev.com/newsletter/december/issue62/newsletter3.php>

In short, create a template file in Word, with double square brackets around variable names or revTalk expressions; save the template file in RTF format; read the file into a variable and use the 'merge' function to dynamically replace the content of each bit of text inside the double square brackets with its value.

HTH,

Jan Schenkel
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>





      




More information about the Use-livecode mailing list