This content has been marked as final. Show 5 replies
You can do that using Apache POI.
Here's a code sample:
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(outputFilename));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheet("Sheet Name");
sheet.setColumnHidden((short) 5, true);
I'm using the most recent version of POI. The one included with ColdFusion may or may not have this functionality, I don't know.
This is not the same as the POI Utility found at www.bennadel.com/projects/poi-utility.htm, right?
I just found that one after doing some searches here and was trying to see if they already had a way to hide columns.
Is this Apache POI just for Apache Server? We're using Windows 2003 Server with IIS.
Ben Nadel's POI utility is nothing more than a CFC/custom tag wrapper to the POI library included with ColdFusion. It's still all Apache POI code behind-the-scenes.
Apache POI is an open-source Apache-license Java library. It has nothing to do with the Apache Web Server, other than being licensed under that foundation (the Apache foundation).
Like I said, a version of Apache POI is already included with ColdFusion. Go to your installation directory and look in lib. On CF8, there is:
The newest version of POI is 3.1, released on 6-29-2008. I haven't had any problems removing the POI included with CF and replacing it with the newer version, but your experience may vary.
Thanks! I looked on our production server and did see the poi 2.5.1 files. Thanks for the code, I'm going to see if I can get it to work here!