Thomas, Mark - BLS CTR wrote:
Sean T. Allen wrote:

  
With yours wouldnt I have to add custom xsl format
tags in the output for the template so that when
it gets passed to build_excel, it can parse
again and call the appropriate format routines?
    

Not at all. How did xsl get involved in this? You haven't mentioned it
before.

  
By xsl I meant native excel file format... and all that brings with it


  
I was thinking more along the lines of being able
to apply formatting information via the template
itself... say with a plugin...
    

I see a couple different scenarios here...

1. Your data doesn't have formatting information in it, but you want it
applied in a manner consistent enough to be able to hardcode it in your
SS::WE code.
2. Your data doesn't have formatting information in it, but you have to
present it in various Excel "looks" and you want to be able to choose them
at runtime (perhaps via a value in the data)
3. Your data doesn't have formatting information in it, but you want it to
be styled arbitrarily by users as if they could run amok with the Excel
application's formatting commands.
4. Your data _does_ have formatting information in it, and you need to
interpret it and style the spreadsheet appropriately.

My straightforward example assumed #1. Perhaps you were thinking of one of
the others?

-Mark.
  
I wasnt thinking of #1 because I wouldnt nec. know before creating a template
what said formatting was and I dont want to muck with perl code after the fact.

#2 was in general what I thought you were speaking of... again not something I'm terribly fond
of when I think of it...

I think I was going for somewhere between 3 and 4 depending on exactly what we mean by data...

If by data we mean the template then 4
If by data we mean the actual data that would change from file creation to file create then 3 was
what i was thinking off...

Thus the idea of using a plugin that supplies various functions for spreadsheet creation inside
of a tt2 file. and depending on a runtime selection of final output excel,tsv,csv et al.
the functions would format passed in data properly in the output file.

So the plugin would provide a unified interface to styling, adding columns, adding rows etc
and could basically act as a envelope and pass the real work to whatever delegate class is
selected at the time of processing.

But again I havent thought this all the way through...

but something like

[% USE sheet = spreadsheet( filetype ) %]
[% FOREACH row IN rows %]
[% sheet.start_row() %]
[% FOREACH cell IN row.cells %]
[% sheet.add_cell( cell.data ) %]
[% END %]
[% sheet.end_row() %]
[% END %]

then you either add formatting via say an additional flag to add_cell
so you could do:

[% sheet.add_cell( cell.data, cell.style ) %]

if the data carries style info with it.

or if it doesnt but you know the 2nd loop needs to be a date...
you code hardcode there... etc etc...
whatever the possibility...

My question would be as I havent use tt2 for very long is,
can I do this:

[% USE sheet = spreadsheet( filetype ) %]
[% FOREACH row IN rows %]

[% sheet.add_row(

[% FOREACH cell IN row.cells %]
[% sheet.add_cell( cell.data ) %]
[% END %]

) %]

[% END %]

in some fashion, with blocks or something else of the sort...

so that is the basic idea of what i was thinking...




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

Reply via email to