Performing a mail merge using rails and ? any ideas?

When the user clicks a link, i want to merge the current customers details into a word document (*.doc) and return it to the user as a download.

Does anybody have any ideas on what the best way to do it is?

I'm racking my brains trying to think of the best way to do this.

My ideal scenario :

1. User searches for customer 2. User selects which type of document to open, e.g. Reminder Letter 3 3. Browser sends the user a doc file, with the customers details already in the address part, ready for editing/printing.

ANy ideas welcome

Thanks

Chris

This probably doesn't help much, but would a PDF document be acceptable instead of a Word document? I recall reading about a package that produces PDFs from within PHP scripts.... here's the ref from the book: PHP Pdf creation - R&OS download | SourceForge.net. I have no idea if such a beast exists for RoR (having a grand total of about 5 days of experience in the field myself), but I would be interested in learning if one did, as I would find it useful myself.

--wpd

There’s PDF::Writer for Ruby.

http://ruby-pdf.rubyforge.org/pdf-writer/

Chris - (

There’s PDF::Writer for Ruby.

http://ruby-pdf.rubyforge.org/pdf-writer/

This probably doesn’t help much, but would a PDF document be acceptable instead of a Word document? I recall reading about a package that produces PDFs from within PHP scripts… here’s the ref from the book: http://sourceforge.net/projects/pdf-php/. I have no idea if such a beast exists for RoR (having a grand total of about 5 days of experience in the field myself), but I would be interested in learning if one did, as I would find it useful myself.

–wpd

When the user clicks a link, i want to merge the current customers details into a word document (*.doc) and return it to the user as a download.

Does anybody have any ideas on what the best way to do it is?

I’m racking my brains trying to think of the best way to do this.

My ideal scenario :

  1. User searches for customer
  2. User selects which type of document to open, e.g. Reminder Letter 3
  3. Browser sends the user a doc file, with the customers details already in the address part, ready for editing/printing.

ANy ideas welcome

Thanks

Chris

Posted via http://www.ruby-forum.com/.

I missed the original post - so hopefully I’m answering the right question.

I’ve done this exact thing before -

1, create a word template setting bookmarks.

  1. Use the ruby OLE (activex) library to control word, iterating over the bookmarks, placing data in the new word doc from the database.

  2. Then save the file, and sendfile it back to the users browser.

That’s the rough outline - you should be able to google for code samples. If you get really stuck let me know - I’m really busy - but can likely help out.

cheers,

Jodi