Creating Excel Files Faster With ColdFusion And POI Custom Tag Updates

Posted August 1, 2008 at 8:38 AM

Tags: ColdFusion

I was using my POI Utility ColdFusion custom tags to create true Excel reports for a client. Some of the reports that they are running were really long (thousands of rows) and the reports were just dying. I had to do something, so I went into the POI custom tags and totally reengineered the way they work. Rather than creating a new instance of the CSSRule.cfc ColdFusion component for every single cell.cfm, I am now creating only one instance of it and caching it in the document.cfm tag. Instead of it housing the CSS properties for a cell, I rebuilt it to be merely act as a utility object to which CSS "struct"s are passed. The drastic decrease in CreateObject() calls was enough to give a good performance boost. In addition to that, I have also cut out as many method calls as I possibly could. On large reports, even calling a simple method could add seconds to the processing time. I am now relying on StructAppend() to take care of must of the cascading logic of "cascading" style sheets; this has also proved to be a good performance boost.

Since I was in there, I have fixed the last few outstanding ColdFusion MX7 compatibility issues. I have also moved the above performance updates to the CFMX 7 version as well. I hope that doesn't create new CFMX 7 bugs (I ran it on a CF8 box and at least it didn't error out for syntax reasons).

The updated code is available from my POIUtility.cfc Project page.

Comments (9)  |  Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page




Keep your Web site content fresh and your overhead costs low with Savvy Content Manager

Reader Comments

Just 15 minutes ago a client asked me for just this thing due asap. 15 minutes later it's already done and ready for their use. thanks Ben! Good stuff.

Posted by Joshua Cyr on Aug 1, 2008 at 9:17 AM


Awesome stuff :)

Posted by Ben Nadel on Aug 1, 2008 at 9:46 AM


Nice work. A very useful utility, and now even better! :)

Posted by Adam Presley on Aug 1, 2008 at 1:55 PM


@Adam,

Thanks man. Glad you like.

Posted by Ben Nadel on Aug 1, 2008 at 1:56 PM


can you add the related blog entries to the project page?

Posted by zac spitzer on Aug 1, 2008 at 10:33 PM


Thanks for the information, nice site

Posted by elena on Aug 4, 2008 at 7:37 AM


Hi Ben,

There is a minor bug in CFMX7.

Invalid token '{' found on line 144 at column 48.

File: Document.cfm

Original Line 144:
<cfset VARIABLES.CellAliases = {} />

Change to:
<cfset VARIABLES.CellAliases = StructNew() />

The perfomance is very good !! :)

Thanks Ben.

Posted by Plutarco Gonzalez on Aug 11, 2008 at 12:54 PM


@Plutarco,

Oh man, good catch. The problem with running this on a ColdFusion 8 box is that I can only guess that i have caught all the "Errors". Thanks for pointing this out.

Posted by Ben Nadel on Aug 11, 2008 at 7:38 PM


@Plutarco,

I have updated the most recent download to include this fix. Again, thanks for the catch.

Posted by Ben Nadel on Aug 11, 2008 at 7:41 PM


Post Comment  |  Ask Ben


Home   |   Web Log   |   ColdFusion   |   Projects   |   Resume   |   Job Form   |   Search   |   Contact
Epicenter Consulting - Custom Software Solutions for Business Evolution HostMySite.com - The Leader In ColdFusion Hosting