Java version: 1.5 Tomcat: 5.5 POI jars: C:\Tomcat\webapps\websrv\WEB-INF\lib
Including: poi-3.6 poi-contrib-3.6 poi-ooxml-3.6 poi-scratchpad 3.6 ooxml-schemas-1.0 xmlbeans-2.3.0 dom4j-1.6.1 geronimo-stax On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <[email protected]>wrote: > > Yes, this file was created using Excel 2007. The file was originally an > > .xls, and I migrated it to .xlsx (however, I have tried uploading both > new > > and modified .xls files and it won't budge). > > > > Per request, I unzipped the .xlsx files and the reported structure is > this: > > > > _rels Folder > > docProps Folder > > xl Folder > > [Content_Types].xml > > What's in this file? > > > Inside the xl folder I found the following files: > > > > _rels Folder > > printerSettings Folder > > theme folder > > worksheets folder > > sharedStrings.xml > > styles.xml > > workbook.xml > > > > Etcetera. Truth be told, it seems the file is doing all right. > > > > I'll post my code (where it breaks) and see if there's something with the > > code (although that wouldn't make sense, since it works perfectly fine in > > this machine -- with both .xls and .xlsx files). > > What versions of Java are you running where it works? > > What version of Tomcat does your server use? Where are the POI jars in your > Tomcat installation? > > Regards, > Dave > > > > > > public void loadFile(File oFileToLoad) throws FileNotFoundException, > > LoaderException, ValidationException { > > Workbook oWorkgroup; > > > > m_oFileName = oFileToLoad; > > try { > > //LOG.Log("ExcelFile - Loading file name: " + > > m_oFileName.getPath(), LOG.LOG_TYPE_TRACE); > > m_oIn = new FileInputStream(m_oFileName); > > > > > > oWorkgroup = WorkbookFactory.create(m_oIn); > > > > if (oWorkgroup.getNumberOfSheets() == 0) { > > // page not found throw exception > > throw new LoaderException("Excel document does not contain a > > workbook"); > > } > > > > m_oSheet = oWorkgroup.getSheetAt(0); > > > > m_nTotalRows = getTotalRows(); > > > > //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows, > > LOG.LOG_TYPE_TRACE); > > } catch(OldExcelFormatException e){ > > throw new ValidationException("This is an Excel 95 File, we can > > process only Excel 97-2007. ", > > 1, ValidationException.EXCEL_95_ERROR); > > > > }catch (IOException ioe) { > > //LOG.LogErrors(ioe); > > ioe.printStackTrace(); > > throw new LoaderException("Exception reading the excel > document"); > > > > } catch (InvalidFormatException e) { > > // Catch created for Workbook.create method. Unspecified. > > > > e.printStackTrace(); > > } > > } > > > > Any thoughts? > > > > On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <[email protected] > >wrote: > > > >> Was this file created with Excel or another application like OpenOffice? > >> What version of that application? > >> > >> Try unzipping the xlsx file and reporting the structure. These OOXML > files > >> are really zipped up directories of xml files. I suspect that there is > >> something in your content type that POI does not understand. > >> > >> Is this a file that you can share? If so, then I would suggest that you > >> create a bugzilla entry so that a developer can take a look when they > have > >> time. > >> > >> Regards, > >> Dave > >> > >> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote: > >> > >>> I've verified and the file is functional. I'm really clueless, atm. > >>> > >>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <[email protected]> wrote: > >>> > >>>> > >>>> Is it possible that the structure of the file is being mangled > somehow? > >>>> Have > >>>> you tried to open the file using Excel after it has been ftp'd into > the > >>>> folder on your server? > >>>> > >>>> Yours > >>>> > >>>> Mark B > >>>> > >>>> > >>>> Jorge Moya wrote: > >>>>> > >>>>> I'm sorry for spam, but I menat it breaks when it tries to extract > the > >>>>> info > >>>>> from the file. > >>>>> > >>>>> Thanks in advance. > >>>>> > >>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <[email protected]> > wrote: > >>>>> > >>>>>> What do you mean, exactly? I'm uploading the files through an FTP > >>>> server, > >>>>>> and after upload I execute the validation of my app which proceed to > >>>>>> extract > >>>>>> the information from a designated folder, but it breaks when it > tries > >> to > >>>>>> upload the file with mentioned errors. > >>>>>> > >>>>>> > >>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher > >>>>>> <[email protected]>wrote: > >>>>>> > >>>>>>> Hi, > >>>>>>> > >>>>>>> You should write the uploaded file to your temporary file and then > >> read > >>>>>>> it > >>>>>>> in. > >>>>>>> > >>>>>>> OOXML files are zip files and are not accessed non-serailly. The > user > >>>>>>> might stop transfer or the network connection might break. > >>>>>>> > >>>>>>> Regards, > >>>>>>> Dave > >>>>>>> > >>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote: > >>>>>>> > >>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx > document > >>>>>>> using > >>>>>>>> POI API and the ss.usermodel (using an app I made), however when I > >>>>>>> tried > >>>>>>> to > >>>>>>>> upload the file to the server, it returned me these errors on the > >>>>>>> server's > >>>>>>>> tomcat console: > >>>>>>>> > >>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't > >>>> read > >>>>>>>> content t > >>>>>>>> ypes part ! > >>>>>>>> at > >>>>>>>> > >> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte > >>>>>>>> ntTypeManager.java:107) > >>>>>>>> at > >>>>>>>> > >> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi > >>>>>>>> pContentTypeManager.java:56) > >>>>>>>> at > >>>>>>>> > >> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java: > >>>>>>>> 136) > >>>>>>>> at > >>>>>>>> > >> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585) > >>>>>>>> > >>>>>>>> at > >>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222) > >>>>>>>> at > >>>>>>>> > >> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja > >>>>>>>> va:63) > >>>>>>>> at > >>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84) > >>>>>>>> at > >>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50) > >>>>>>>> at > >>>>>>>> > >> com.msights.core.validation.ValidationModule.run(ValidationModule.jav > >>>>>>>> a:154) > >>>>>>>> at java.lang.Thread.run(Thread.java:595) > >>>>>>>> > >>>>>>>> Any idea of what's happening? Uploading .XLS files work fine. > >>>>>>> Extracting > >>>>>>>> info on my local machine works fine, as well. > >>>>>>> > >>>>>>> > >>>>>>> > --------------------------------------------------------------------- > >>>>>>> To unsubscribe, e-mail: [email protected] > >>>>>>> For additional commands, e-mail: [email protected] > >>>>>>> > >>>>>>> > >>>>>> > >>>>> > >>>>> > >>>> > >>>> -- > >>>> View this message in context: > >>>> > >> > http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html > >>>> Sent from the POI - User mailing list archive at Nabble.com. > >>>> > >>>> > >>>> --------------------------------------------------------------------- > >>>> To unsubscribe, e-mail: [email protected] > >>>> For additional commands, e-mail: [email protected] > >>>> > >>>> > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
