[ic] Excel/PDF files on-the-fly

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Mon Aug 26 17:42:02 2002


(Lazy quoting fixed, please don't do that)

Quoting Michael Stearne (mstearne@entermix.com):
> Rene Hertell wrote:
> 
> >Hi,
> >
> >Has anyone created an excel or PDF file that is always downloadable with the
> >source pulled out from the db in real-time? I tried to check the excel
> >export-function from the UI, but that contains too many steps (and I don't
> >want to write a file to the server when someone downloads these files).
> >
> >What I would need is a result from a sql query that should be in Excel
> >format. A formatted version as a PDF-file would then be my next step after I
> >have solved the excel problem...
> >
> >I'm able to create files that have text-content like vcards, csv-files etc,
> >but everything else is seems to be to complicated for the moment...
> >
> >I would appreciate it very much if someone could give me some hints in how
> >to solve these two problems.
> >
>
> What do you mean by Excel format?  Excel is a closed binary format, 
> there is no way to make a file that is truly in Excel's native format. 

Au contraire.

> What you might do is just create a CSV file and name it .csv.  Excel or 
> any other spreadsheet that owns the .csv extension in Windows, OS X or 
> Gnome/KDE will open the file and automatically translate it into it's 
> native format.  As for PDF, you might export the data into an HTML table 
> and then use HTMLDOC (http://easysw.com/htmldoc/) to convert that HTML 
> file on-the-fly to a PDF.

Actually, you can do it quite easily by building a UserTag based
on the [backup-database ...] tag. That uses Spreadsheet::WriteExcel.

Look at lib/UI/pages/admin/dbdownload.html for an example
of how it is called, and at the usertag/backup_file.tag for
the actual code.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers