I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online.
A:
Not sure if you need to stick with JXL, but the best library for handling Excel files is Apache's POI HSSF.
I think there are plenty of examples on the website I provided, but if you need further assistence, let me know. I may have a few examples laying around.
Just out of curiosity, POI stands for Poor Obfuscation Interface and HSSF is Horrible SpreadSheet Format. You see how much Apache loves Microsoft Office formats :-)
kolrie
2008-09-29 21:07:38
+2
A:
After messing around awhile longer I finally found something that worked and saw there still wasn't a solution posted here yet, so here's what I found:
try {
String fileName = "file.xls";
WritableWorkbook workbook = Workbook.createWorkbook(new File(fileName));
workbook.createSheet("Sheet1", 0);
workbook.createSheet("Sheet2", 1);
workbook.createSheet("Sheet3", 2);
workbook.write();
workbook.close();
} catch (WriteException e) {
}
Kamikaze Mercenary
2008-09-29 21:16:38
Out of curiosity, any particular reason why you are sticking to JXL?
kolrie
2008-09-29 21:28:06
It's already in use in our project fairly extensively and I'm not the team lead :P
Kamikaze Mercenary
2008-09-29 22:12:36
Gotcha! :) I have used POI HSSF and it's very flexible. If you were starting something from grounds up, I would say to go down that path. But since you're stuck with JXL, good luck :)
kolrie
2008-09-29 22:53:02
Heh thanks, I'll definitely keep that in mind for next time :)
Kamikaze Mercenary
2008-09-30 03:26:45
A:
This page gives an example of how to create a new Excel file with JXL: http://www.java-tips.org/other-api-tips/jexcel/how-to-create-an-excel-file.html
Tom
2008-09-29 21:16:59