D
David Thielen
I don't know if this is an Excel bug or a J# bug (or both). The XLSX file
(which is a zip file) at http://www.windwardreports.com/temp/BadXlsx.zip
throws a ZipException (extra read failure) when reading the files using the
following code (on entry 14 of 18):
ZipInputStream zis = new ZipInputStream(in);
ZipEntry ze;
byte data[] = new byte[BUFFER_SIZE];
docxFiles = new ArrayList();
while ((ze = zis.getNextEntry()) != null) {
if (! ze.isDirectory()) {
String entryName = ze.getName();
ByteArrayOutputStream destData = new ByteArrayOutputStream();
int len;
while ((len = zis.read(data, 0, BUFFER_SIZE)) != -1)
destData.write(data, 0, len);
destData.flush();
docxFiles.add(new DocxFile(entryName, destData.toByteArray()));
destData.close();
}
zis.closeEntry();
}
zis.close();
Any idea what is going on and what the work-around is? The XLSX file was
created with Excel 2003 using the MS AddIn to read/write XLSX files. WinZip
can open the file with no problem.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
(which is a zip file) at http://www.windwardreports.com/temp/BadXlsx.zip
throws a ZipException (extra read failure) when reading the files using the
following code (on entry 14 of 18):
ZipInputStream zis = new ZipInputStream(in);
ZipEntry ze;
byte data[] = new byte[BUFFER_SIZE];
docxFiles = new ArrayList();
while ((ze = zis.getNextEntry()) != null) {
if (! ze.isDirectory()) {
String entryName = ze.getName();
ByteArrayOutputStream destData = new ByteArrayOutputStream();
int len;
while ((len = zis.read(data, 0, BUFFER_SIZE)) != -1)
destData.write(data, 0, len);
destData.flush();
docxFiles.add(new DocxFile(entryName, destData.toByteArray()));
destData.close();
}
zis.closeEntry();
}
zis.close();
Any idea what is going on and what the work-around is? The XLSX file was
created with Excel 2003 using the MS AddIn to read/write XLSX files. WinZip
can open the file with no problem.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm