Todd Freeman wrote:
Not the way I was thinking of it but it could work. Couple things see for that would be creating a template that includes a templateOn Fri, Jan 07, 2005 at 10:45:38AM -0500, Sean T Allen wrote:Todd Freeman wrote: based on a run decision that you pass and it selects the appropriate one of yours above. One thing I would consider adding is the ability to add in arbitrary templates via PROCESS at different point something like say when doing a row foreach or a column for each... I moved the functionality you have in the template further down into plugin classes... which makes figuring out how to do formatting a bit more of an issue.. but either solution would require a formatting abstraction so you could pass the same formatting info in the data and have it properly translated into the end formats requirements. I didn't think of doing it the way you have it because the data I don't like push everything into a row/cell format in the code calling the template but again that could be pushed into a higher level template... You might have a problem with WriteExcel based on: its output has to be tied to a file handle if you aren't send the process results to someplace other than STDOUT it isnt an issue, however if you are sending it to a file... well... template doesn't pass where the output is going down to your plugin... mine as it stands ( with some application specific SET code taken out looks like: [% USE sheet = Spreadsheet( type => "$type" ) -%] [% sheet.start() -%] [% sheet.add_row( [ 'First Name', 'Last Name', 'Address', 'Address2', 'City', 'State', 'Zip', 'Country', 'Phone number', 'Email', 'Media Code', 'JF Reference #(FEI ORDER)', 'Offer SKU', 'Upsell', 'Tender (AX VI MC DC)', 'Credit Card Number', 'Expiration Date', 'Total Order Cost' ] ) -%] [% FOREACH order IN orders -%] *** code to determine sku and upsell cut *** [% cells = [ order.fname, order.lname, order.address1, order.address2, order.city, order.state.abbrev, order.zipcode, order.country.abbrev, order.phone, order.email, order.mediacode, "JF$order.id", sku, upsell, order.customer.paymethod.code, order.customer.ccnum, order.customer.ccexp, order.ordertotal ] -%] [% sheet.add_row( cells ) -%] [% END -%] [% sheet.stop() -%] But it could also work if you just did.... [% USE sheet = Spreadsheet( type => "$type" ) -%] [% sheet.start() -%] [% sheet.add_row( headers ) -%] [% FOREACH order IN orders -%] [% sheet.add_row( row.cells ) -%] [% END -%] [% sheet.stop() -%] or something similar... the only formatting it does right now is for excel files it sets all cells to 'text' but when i need it, i'll work out that issue... currently i have tsv, csv, html, and xls output defined... as well as a basic text type that can take any user supplied cell and row seps. its basic but it serves my current purposes... 1. template, multiple runtime determined output formats... In order to solve the aforementioned WriteExcel issue, the plugin classes below Spreadhseet that I wrote buffer all output until stop is called at which point its returned. Only the 'xls' one needs this but I made the others operate the same way to keep the return results the same across the board. |
begin:vcard fn:Sean T. Allen n:Allen;Sean T. org:USA Herbals, LLC email;internet:[EMAIL PROTECTED] title:Tech Guru tel;work:718-388-5424 x-mozilla-html:FALSE version:2.1 end:vcard
