On 15 Mar 2012, at 22:56, Alexander Dutton wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> Random ideas follow; usefulness arguable ;-).
> 
> On 15/03/12 22:13, Paolo Castagna wrote:
>> Damian Steer wrote:
>>> On 15/03/12 15:33, Paolo Castagna wrote:
>>>> Sometimes, people want to load data into a spreadsheet, either 
>>>> Microsoft Excel or OpenOffice/LibreOffice Calc. […]
>>> 
>>> I've done this fairly recently using Apache POI. They have a
>>> streaming implementation which is fairly easy on memory.
>> 
>> […] Is your code anywhere available and/or open source?

It's not, and it wouldn't be useful since the bulk is pointless styling code.

Look at <http://poi.apache.org/spreadsheet/how-to.html#sxssf> and you'll get 
the idea. About 20 lines of code?

> Excel can be rather simple as you can just about output an HTML table
> and stick an appropriate extension/media type on it. For example, we
> stick resultsets through this renderer/template:

Yes, this is a cunning trick. Excel will load html tables posing as excel 
spread sheets :-)

> If you wanted to do ODS and Office Open XML (XLSX) without an external
> dependency, you could have a template Zip archive and drop an
> appropriately-constructed XML file into it, but that'd be a fair bit
> more effort…

I did look into this, because how hard can a table representation in xml be?
The answer was: really very hard indeed.

Damian

Reply via email to