Re: [Templates] Using TT to create word docs.
On Thu, 29 Jan 2004, Randall Marbach wrote: Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. As pointed, I would suggest using pdf documents where possible. I use a LaTeX template, fill in using TT fields (from forms and DB), and convert it to pdf (it may be done directly using TT). It is possible to adapt it to word documents: write your word thing, using tt fields (in word: pay attention not to change formatting in the middle of the tt expr: Dear [%user%], you were supposed to pay $ [%amount%] for ... (using formating where necessary). Then save your text as an rtf file (which is a text file, somewhat similar to latex). Check that there is no tag broken by formatting. Add your TT entries (DBI connections, FOREACH loop), and use it as a template. I tried and it works for simple documents. -- Franco Bagnoli (franchino) [EMAIL PROTECTED] ([EMAIL PROTECTED]) virtual location: Dipartimento di Energetica S. Stecco ultra-virtual affiliation: Centro Dinamiche Complesse (CSDC-Firenze) real location: Dip. Matematica Applicata G. Sansone, Universita' Firenze, Via S. Marta, 3 I-50139 Firenze, Italy. Tel. +39 0554796422, fax: +39 055471787 ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
RE: [Templates] Using TT to create word docs.
Hi Randall, I do it a lot, no problem - Create the document in Word as you would like it to be - Put in clearly visible placeholders for your data, I use , , CCC and so on - Do a Save As... RTF format (some Word versions offer 2 variants, choose the MS RTF or something, it's not standard (of course), but complete in terms of Word specifics). - Open the RTF document in Textpad or other ascii editor - Replace the placeholders with familiar [% %] tags, plus loop and conditional tags of course - If possible avoid tables, use tabs instead. - Avoid editing the template in Word! Word will ruin your carefully entered tags. - The only way allowed to add tags in Word is with Edit Paste Special Paste As Text. But stay with the ascii editor for starters - Wear goggles and a helmet, as there's a lot of RTF to weed through - You may want to rename the extension into .doc again (at the file level), the doc will remain in RTF format but end users are less likely to faint Use styles and define the default style to your liking (in contrast to: apply font and style changes repeatedly on multiple paragraphs). Working this way will give you document lighter on RTF tags. cheers ~henq -Original Message- Message: 3 Date: Thu, 29 Jan 2004 13:26:27 -0800 (PST) From: Randall Marbach [EMAIL PROTECTED] To: TT [EMAIL PROTECTED] Subject: [Templates] Using TT to create word docs. Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. .. What would be the best approach to this problem? ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
RE: [Templates] Using TT to create word docs.
Thanks henk and Franco I have been experimenting with the technique you guys describe and it looks quite promising. Just have to brush up on RTF now. From: henk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: [Templates] Using TT to create word docs. Date: Sat, 31 Jan 2004 00:34:08 +0100 Hi Randall, I do it a lot, no problem - Create the document in Word as you would like it to be - Put in clearly visible placeholders for your data, I use , , CCC and so on - Do a Save As... RTF format (some Word versions offer 2 variants, choose the MS RTF or something, it's not standard (of course), but complete in terms of Word specifics). - Open the RTF document in Textpad or other ascii editor - Replace the placeholders with familiar [% %] tags, plus loop and conditional tags of course - If possible avoid tables, use tabs instead. - Avoid editing the template in Word! Word will ruin your carefully entered tags. - The only way allowed to add tags in Word is with Edit Paste Special Paste As Text. But stay with the ascii editor for starters - Wear goggles and a helmet, as there's a lot of RTF to weed through - You may want to rename the extension into .doc again (at the file level), the doc will remain in RTF format but end users are less likely to faint Use styles and define the default style to your liking (in contrast to: apply font and style changes repeatedly on multiple paragraphs). Working this way will give you document lighter on RTF tags. cheers ~henq -Original Message- Message: 3 Date: Thu, 29 Jan 2004 13:26:27 -0800 (PST) From: Randall Marbach [EMAIL PROTECTED] To: TT [EMAIL PROTECTED] Subject: [Templates] Using TT to create word docs. Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. .. What would be the best approach to this problem? __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
RE: [Templates] Using TT to create word docs.
I am not aware of any platform-neutral method for writing a Word document, but you could create the next best thing, a Rich Text Format file using one of the following methods. * Create an RTF file directly with something like RTF::Writer or * Generate HTML with Template Toolkit and feed the output to HTML::FormatRTF Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Randall Marbach [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:26 PM To: TT Subject: [Templates] Using TT to create word docs. Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. I am using perl and Class::DBI for the database side and a plan to use TT for the reporting side that I will be using to generate the HTML for the web. I would also like to use the TT to somehow produce the required word document. What would be the best approach to this problem? I am new to TT and I just started reading the Badger Book, so any advice would be deeply appreciated. TIA Randy __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
RE: [Templates] Using TT to create word docs.
You may also wish to inquire if PDF might be suitable, as there are several approaches for generating them fairly easily. Bryce On Thu, 29 Jan 2004, Peter Guzis wrote: I am not aware of any platform-neutral method for writing a Word document, but you could create the next best thing, a Rich Text Format file using one of the following methods. * Create an RTF file directly with something like RTF::Writer or * Generate HTML with Template Toolkit and feed the output to HTML::FormatRTF Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Randall Marbach [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:26 PM To: TT Subject: [Templates] Using TT to create word docs. Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. I am using perl and Class::DBI for the database side and a plan to use TT for the reporting side that I will be using to generate the HTML for the web. I would also like to use the TT to somehow produce the required word document. What would be the best approach to this problem? I am new to TT and I just started reading the Badger Book, so any advice would be deeply appreciated. TIA Randy __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] Using TT to create word docs.
I am not aware of any platform-neutral method for writing a Word document, but you could create the next best thing, a Rich Text Format file using one of the following methods. * Create an RTF file directly with something like RTF::Writer or * Generate HTML with Template Toolkit and feed the output to HTML::FormatRTF The best way of creating Word docs I heard of is to use OLE Automation to drive the Word to create the document and to build its contents. Maybe one could generate some kind of script doing this with TTK (or some params for programs or...) Nevertheless I'd strongly suggest to generate PDFs instead of DOCs. At least they always have the same page breaks whatever printer you install... ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates