ColdFusion Export to Excel
March 7, 2009 ·
I wrote this excel custom tag so I could export reports in my coldfusion system, and compare the date on multiple notebooks. Additionally, I've added the following functions:
- You can specify the type of data in a particular field (string, number, currency, date)
- You can specify row colors
- You can specify whether to display a header row; you can even freeze the header row
- Yes/No format to the data types you can specify and includes a debug attribute that will turn off the Excel conversion so you can view any errors you are getting
- You can have multiple Workbooks (Excel Tabs)
This tags uses Excel XP's XML format to let you pass in multiple queries to create an Excel workbook containing multiple spreadsheets, and has been tested with
- Excel 2000
- Excel 2003
- Excel XP
- Excel 2007
A VTM file is also included.
Download the custom Function here.
Related Entries:
Did you like this post? Then
show your Support
Posted in: ColdFusion Tutorials
2 responses
-
Hey, thanks for the idea, but two issues:
First, your link points to the wrong file; instead of
http://downloads.alteredpixels.net/excel.zip
it should be:
http://downloads.alteredpixels.net/projects/cf_excel.zip
Luckily, you haven't locked down directory browsing, or I wouldn't have found it at all.
Second, I'm still getting the warning from Office 2007, saying that the file type is different from the MIME type. Did you ever find a way around this?
That's the real problem I am trying to solve; I don't care what format I send the data out (html, xml ... trying to avoid .csv). But it annoys the users to have to confirm each spreadsheet. -
I haven't found away around it yet, but It's really nothing to fret about. That warning I'm htinking is because Office 2007 (especially Excel) is reading the XLS as a CSV, however when you Ok through the message, the sreadsheet works just as it is defined to.
I suspect it's because Microsft has changed the XML format with Office 2007, however I haven't been able to confirm this from MS or have found any additonal resources online regarding it.