I'm having some major difficulty here that I'm hoping someone can help me with. I've googled my brains out trying to find an answer that works, and am having no success. We are now standardized at Excel 2007 and our users want to not have to save the files as 97-2003 format just to read the file. The problem I'm having is that I'm using the apache struts FormFile. XSSF does not care for the InputStream with FormFile. I've tried creating a new FileInputStream using the full path (I extract that prior to uploading so that it's part of the ActionForm) and using the full path (which includes the filename) for creating the new Workbook. I've tried a variety of things, including using the WorkbookFactory. I'm at a loss. Everthing I see says it tells you how to read a 2007 Excel file, but all of their examples are for ".xls" files. I have no doubt they work, but I would like to see something for 2007+ format.
Here's the code:
Maybe I missed something, but I'm now pounding my head against a brick wall. This is my umpteenth iteration at trying something to make this work. I appreciate any information that may help. I'm willing to try anything, including standing on my head reciting Shakespeare. If that works, I'll take it.
I added the dom4j.jar to my classpath (found that somewhere, figured I'd try it) and now I'm getting "org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException". Am I missing a jar or something? Here's what I have besides my spring and struts jars:
Yes, I expect you are missing one of the required jars. I know I had to go through that cycle a couple of times. The stack trace you got (but didn't post) should contain useful information about what that exception was all about.
I wish. I looked at the list of jar files I'm supposed to have on the Apache site and even added a few (like the dom4j.jar file - that isn't on the list). I'm getting a org.apache.poi.POIXMLException error: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException. The stack trace is null. There is no other information and it's driving me crazy. The only thing I don't have is thte xmlbean jar. I think that's right. I will try adding that and see if that works. It's the only thing I haven't tried (just came across that).
SON OF A GUN!!! That did it. Here's my final portion (I actually had the xbean.jar (and possibly an older version that the one I downloaded and replaced it with), but I was missing the other things that were in the lib: