Skip to main content

The CFPOI Project: CFSPREADSHEET (and Eventually More!) for Any CFML Engine

When I first heard about the addition of CFSPREADSHEET to ColdFusion 9 and confirmed my suspicion that it was based on the Apache POI Project, I decided to do a little work to see what would be involved with creating a CFSPREADSHEET solution that would not only work on any CFML engine (Open BlueDragon, Railo, or Adobe CF 6.1, 7, and 8), but one that would also offer more flexibility in terms of the code syntax, and would expose parts of the POI functionality that aren't available in CF 9.

Like so many seemingly little experiments this turned into a project with a life of its own, namely the CFPOI Project that is available now on Google Code, and there is also a related group/mailing list for the project on Google Groups. I looked around at some of the other CFML-based wrappers people had come up with, but partially because they were dated or incomplete, and partially just because I wanted to tackle this on my own to dig into POI, I started from scratch.

What I wound up with is this:

  • A single Spreadsheet CFC that exposes a great deal of POI's spreadsheet functionality through simple object.methodName() syntax. I personally vastly prefer this syntax to the way things are done in CF 9 (e.g. mySpreadsheet.addRows(myQuery) vs. SpreadsheetAddRows(mySpreadsheet, myQuery)), and this also allows for more flexibility in the case of some features. For example, unless I'm misunderstanding how this works in CF 9, you can't switch the active worksheet on the fly while the workbook object is in memory. I allow for that when the spreadsheet CFC is used.

  • A set of UDFs that mirror the syntax of the SpreadsheetXXX() functions in CF 9, so you can use that syntax if you prefer.

  • A set of custom tags that mirror the syntax of the <cfspreadsheet> tag in CF 9. The only difference is the underscore in the tag (<cf_spreadsheet>) since it's a custom tag. Other than that, all the attributes and functionality are identical to CF 9.

This has been a really fun little task to work on (I'm a nerd like that), and only took up some of my spare time for about a week, so it was pretty darn easy to build.

Limitations at this point:

  • As usual, check the bug list! (It's empty now but I'll get to it.) There are a couple of things yet to be implemented.

  • Supports XLS format only at this point, but it will be dead simple and quick to add XSLX. I'll do that once the XLS stuff is 100% done.

  • Does not support format; as with XLSX, I'll look into adding that very soon.

  • If you're on shared hosting, don't have access to add JAR files to your CFML engine, can't use CreateObject("java"), etc. then I'm sorry but you're out of luck. (Might I suggest getting a VPS? ;-)

  • No build process or self-contained download yet, so you'll have to grab the code from SVN.


  • Apache POI 3.5 beta 6 or better.

  • OpenBD, Railo, or Adobe CF 6.1, 7, or 8. Dropping this into OpenBD or Railo is simple since neither engine (at least last I looked) includes POI. On Adobe CF you may run into conflicts with existing POI JAR files that are rolled into CF. (CF 8 for example has a very old version of POI included.) See here for an overview of how to load the newer Java classes into CF 8 on the fly.


  • Grab the Apache POI JAR files and drop them into your CFML engine's lib directory (or if you're on Adobe CF and this will cause conflicts, see the link above).

  • Grab the code from the CFPOI Project Google Code site and put this in the top level of the project on which you want to use this functionality. (Specifically CreateObject("component", "org.cfpoi.spreadsheet.Spreadsheet") needs to work!)

  • Start using it! Start with <cfset mySpreadsheet = CreateObject("component", "org.cfpoi.spreadsheet.Spreadsheet").init() /> and go from there.

What's next? Rounding out the spreadsheet functionality, and then moving on to presentation and word processing documents. I'm hoping CFPOI can grow to be a full-blown, easy-to-use solution that mirrors the core functionality of Apache POI itself, but makes it more accessible for CFML developers regardless of their choice of CFML engine.

If you want to get involved with the project, PLEASE contact me! Building this stuff out isn't terribly time consuming, but the more help I have with code, documentation, testing, etc. the faster things will get done, and I think this is something from which all CFML developers can benefit. Even if you don't need POI functionality, I think it will serve as a good project to learn from if you're needing to incorporate other Java projects in your CFML applications. (It's easier than you think.)

If you want to see the code in action and learn more, I'll be presenting this on the ColdFusion Meetup on August 6 at noon Eastern time. Hope to see you there.


Have you looked @ Ben Nadel's POI Utility? Maybe that could be ported to work on all cfml engines

Yep, looked at it, but as I said for a few reasons I wanted to start from scratch.

Inability to use createObject(java) would be a tough one to get around but with JavaLoader folks on shared hosting could still possibly use it right?

I honestly don't know about JavaLoader on shared hosting--unfortunately (or fortunately I guess) I've never been in a situation where I've needed Java objects on shared hosting accounts. I guess it would just depend on how they're disabling CreateObject("java") because of course that's the bulk of what's going on in the spreadsheet CFC.


Popular posts from this blog

Installing and Configuring NextPVR as a Replacement for Windows Media Center

If you follow me on Google+ you'll know I had a recent rant about Windows Media Center, which after running fine for about a year suddenly decided as of January 29 it was done downloading the program guide and by extension was therefore done recording any TV shows.

I'll spare you more ranting and simply say that none of the suggestions I got (which I appreciate!) worked, and rather than spending more time figuring out why, I decided to try something different.

NextPVR is an awesome free (as in beer, not as in freedom unfortunately ...) PVR application for Windows that with a little bit of tweaking handily replaced Windows Media Center. It can even download guide data, which is apparently something WMC no longer feels like doing.

Background I wound up going down this road in a rather circuitous way. My initial goal for the weekend project was to get Raspbmc running on one of my Raspberry Pis. The latest version of XBMC has PVR functionality so I was anxious to try that out as a …

Setting Up Django On a Raspberry Pi

This past weekend I finally got a chance to set up one of my two Raspberry Pis to use as a Django server so I thought I'd share the steps I went through both to save someone else attempting to do this some time as well as get any feedback in case there are different/better ways to do any of this.

I'm running this from my house (URL forthcoming once I get the real Django app finalized and put on the Raspberry Pi) using I don't cover that aspect of things in this post but I'm happy to write that up as well if people are interested.

General Comments and Assumptions

Using latest Raspbian “wheezy” distro as of 1/19/2013 (’lll be using Nginx ( as the web server/proxy and Gunicorn ( as the WSGI serverI used heavily as I was creating this, so many thanks to the author of that tutorial. If you’re looking for more details on …

The Definitive Guide to CouchDB Authentication and Security

With a bold title like that I suppose I should clarify a bit. I finally got frustrated enough with all the disparate and seemingly incomplete information on this topic to want to gather everything I know about this topic into a single place, both so I have it for my own reference but also in the hopes that it will help others.Since CouchDB is just an HTTP resource and can be secured at that level along the same lines as you'd secure any HTTP resource, I should also point out that I will not be covering things like putting a proxy in front of CouchDB, using SSL with CouchDB, or anything along those lines. This post is strictly limited to how authentication and security work within CouchDB itself.CouchDB security is powerful and granular but frankly it's also a bit quirky and counterintuitive. What I'm outlining here is my understanding of all of this after taking several runs at it, reading everything I could find on the Internet (yes, the whole Internet!), and a great deal…