Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Replacing placeholders?

From: carlos:lorenz::gmail at: 7-Aug-2007 15:46

Hi Kai, Maybe this old mail from Tim may help you. Take a look:
>>>
Here's an example of dynamically composing a PDF document using records: ;; ====================================================== do %pdf-maker.r records: [ [first_name "Tim" last_name "Johnson"] [first_name "Gabriele" last_name "Santilli"] ] build-page: func[record[block!]][ blue-font: [FONT Courier 4.23 0.0.200] black-font: [FONT Helvetica 4.23 0.0.0] ;; Place any code that you want evaluated inside of parenthesis [ ;; Each page must be a block textbox[ LEFT ALIGN (blue-font) "First Name: " (black-font) (record/first_name) newline (blue-font) "Last Name: " (black-font) (record/last_name) newline ] ] ] ;; make block for the document document: make block! length? records ;; Process records foreach record records[ ;; Use 'compose to evaluate the code and data ;; inside of the parens in the 'page block page: compose/deep build-page record ;; append as a block append/only document page ] write/binary %pdf-test.pdf layout-pdf document ;; ====================================================== It's my hope that someone else may find this as helpful as it was for me in doing it. And as always - thanks to Gabrielle for his good work. cheers Tim
>>>>>
2007/8/7, Kai Peters <kpeters-otaksoft.com>:
> > Hi ~ > > I am trying to use pdfmaker to perform a mail-merge mailout. > > I have created a file holding the dialect code for the letter template: > > thankyou-letter: [ > [ ; the one & only page > page size 216 279 ; US letter > > textbox [ > { Dear $NAME, thank you so much for your generous donation.} p > { And some more text - maybe the same placeholder multiple times > $NAME ...} > ] > ] > ] > All this up to creating the PDF works well. > > I am struggling with this: > How can i replace all instances of placeholders like $NAME in > thankyou-letter with the > mailmerge variables? > > Thanks for any help, > Kai > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. >
-- Carlos Lorenz www.revistaeletronica.com.br Unidade Lorenz Ltda (11) 4034 1971