cfExcelProxy Launched

Ray Camden just approved my project over at RIAForge, so I thought it was a great oppurtunity to talk about it here. Basically, cfExcelProxy is my attempt at using Apache's POI HSSF java libraries to talk to and modify Microsoft Excel files.

Here are the available methods from the main object, cfExcelProxy.cfc:

public - newWorkbook - ( ) cfExcelProxy

Creates a new blank workbook.

public - read - ( string filename ) cfExcelProxy

Reads in an existing workbook (from file).

public - createSheet - ( string name ) cfExcelProxy

Create a new sheet in the workbook.

public - setCell - ( string sheet , numeric row , numeric cell , string value , string class ) cfExcelProxy

Set the value of a cell.

public - dumpQuery - ( string sheet , query query , numeric row , numeric cell , string headerClass , string bodyClass , string collist ) cfExcelProxy

Dump the contents of a query into a sheet, with a starting row and cell.

public - createClass - ( string className , struct props ) cfExcelProxy

Create a class for future use (with setCell).

public - getCellValue - ( string sheet , numeric row , numeric cell ) string

Returns the contents of a cell.

public - getCellRangeValueAsArray - ( string sheet , numeric startrow , numeric startcell , numeric endrow , numeric endcell ) array

Retrieve the contents of a range of cells, and return it as an array.

public - getQueryFromCells - ( string sheet , numeric row , numeric cell , boolean header ) query

Attemps to rebuild a dumped query, from a starting position.

public - autoAdjust - ( string sheet , numeric row ) cfExcelProxy

Allows to auto-adjust the width of the columns.

public - write - ( ) Binary

Returns the binary output from this workbook.

Here's the project's link up at RIAForge. Feel free to download the files and play around with them, let me know what you think and if you have any ideas / questions / suggestions / complaints / insults please let me know ;).

Edit: I changed new for newWorkbook. As Radek pointed out in the comments, new may become a reserved word in CF9. Better safe than sorry! I committed the change to the repository, and I'm just about to release the updated package up at RIAForge.

Comments
Brian Rinaldi's Gravatar How does this compare with Ben Nadel's POI Utility CFC?
# Posted By Brian Rinaldi | 8/3/08 6:27 PM
Francois Levesque's Gravatar I'd say, from quickly browsing through Ben's utility, that his version is probably more complete than mine. My main objective with this project is to learn by getting my hands dirty. I'm not looking to compete against anyone, I'm just throwing my attempts out there to see how they do and what people think about them :).
# Posted By Francois Levesque | 8/3/08 6:51 PM
radekg's Gravatar I think you should change 'new' method name as it probably become reserved keyword in CF9.
# Posted By radekg | 8/4/08 4:53 AM
Francois Levesque's Gravatar @Radek,

Thanks for the info, I hadn't thought of that. I changed the method name to prevent conflicts.
# Posted By Francois Levesque | 8/4/08 7:58 AM
Jose's Gravatar Sorry to be off topic, but is there something similar for MS Word? I have to export a bunch of tables to Word (RTF or DOC is fine) and I'm running CFMX 6.1

Thanks
# Posted By Jose | 8/4/08 10:55 AM
Francois Levesque's Gravatar @Jose,

I did a quick search on Google and couldn't find anything, however Apache's POI library also includes objects for interacting with MS-Word: http://poi.apache.org/hwpf/index.html. Using the same logic than with HSSF it should be easy enough to create simple Word files with Coldfusion.
# Posted By Francois Levesque | 8/4/08 11:51 AM
Jose's Gravatar Hi Francois,

Yea, I also saw that but it looks to be pretty outdated and not supported. Hopefully CF9's cfdocument tag will add support for MSWord and/or RTF.
# Posted By Jose | 8/4/08 12:08 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.000. Contact Blog Owner