Free Support Forum - aspose.com

Device I/O error

Hi,

Given the following code (Java trial version) :

File file = new File(SOURCE); // where SOURCE = path to template
InputStream is = new FileInputStream(file);
Workbook workbook = new Workbook();
workbook.open(is);
workbook.save(out); // where out is a HTTP OutputStream in order to download the file

... this works fine on my local computer but does not on staging environment. There's no Java exception, the downloading is okay but Excel displays an error message when opening the downloaded file: "Device I/O error".

The template is an Excel file whith macros, formulas, graphs and so on.

Local: Windows XP, WebSphere 6, JDK 1.4

Staging: AIX 5.2, WebSphere 6, JDK 1.4

Thanks for your help,

Frank.

Hi Frank,

Thanks for considering Aspose.

We will get back to you soon for your issue.

Thank you.

Hi Frank,

Would you please send an excel file directly into the Http OutputStream without Aspose.Cells to check whether it works well on your environment. It can help to distinguish whether the issue is of the environment or of Aspose.Cells

Hi Frank,

By the way, did you set the Http-header correctly before write and send the OutputStream? Like following code:

response.setContentType("application/vnd.ms-excel");
response.addHeader("content-disposition", "inline; filename=" + resultXLS);

Hi,

I did these tests, even with Open Source libraries (POI and JExcel) with the same template and the previous version of the template. It works with the Open Source librairies but we have performance problems.

With Aspose.Cells and the previous version of the Excel file I have an other error message (translation from french): "The document is damaged and can not be open," when I click the OK button Excel opens the file but without style, and graphs have been "removed." Works fine on local environment with Aspose.Cells.

Regards,

Frank.

Yes I did set the HTTP headers but the content disposition is "attachment", not "inline."

Frank.

Hi Frank,

It seems that we mistake your mean. Do you mean that you get "Device I/O error" and "The document is damaged and can not be open," when you open the file in Ms Excel?

Please save the file to disk and open it in Ms Excel. If the error still occure, please post your created file here.

Hi,

The error still occurs. I have to ask my sponsor if I can share this file, if so I prefer sending the files to a mail box not on public forum.

As I said there is no Java exceptions, the error messages are displayed by Microsoft Excel (in dialog boxes.)

Thanks,

Frank.

I’ve just tested with an empty Excel file and the same error occurs. Here’s the two file attachments.

The downloaded template (from AIX server.)

Hi Frank,

Thanks for the template files and details

We will figure out your issue soon.

Thanks for being patient!

Hi Frank,

Would you please try saving the template file directly on the server (such as by the “save(filename)” method), and check whether the result file can be opened by MS Excel? Thanks for your patient

Hi,

Same result (see attachment), saving on local filesystem works fine.

Thanks,

Frank.

Hi Frank,

Did you mean executing code like “save(filename)” on the server produced the saved.xls? What’s the meaning of “local filesystem” which works fine?

Hi,

"Did you mean executing code like “save(filename)” on the server produced the saved.xls?" : yes I did.

I mean that everything works fine on my local Windows XP and that nothing does on AIX server, same code, same file, saving to HTTP or file outputstream.

Thanks,

Frank.

Hi Frank,

Please try this attached fix. And debug message will be printed to console when invoke save() method, if the output file is still invalid, please post the message here. Thanks a lot for your patience.

Hi,

Thanks for your reactivity; unfortunately it still does'nt work, here's the log from AIX:

[12/19/07 14:38:20:138 CET] 00000041 SystemOut O CompObj
[12/19/07 14:38:20:139 CET] 00000041 SystemOut O stream length: 110, is normal: false, short length:0
[12/19/07 14:38:20:139 CET] 00000041 SystemOut O Workbook
[12/19/07 14:38:20:140 CET] 00000041 SystemOut O stream length: 1006556, is normal: true, short length:128
[12/19/07 14:38:20:361 CET] 00000041 SystemOut O dir
[12/19/07 14:38:20:362 CET] 00000041 SystemOut O stream length: 707, is normal: false, short length:128
[12/19/07 14:38:20:363 CET] 00000041 SystemOut O ThisWorkbook
[12/19/07 14:38:20:435 CET] 00000041 SystemOut O stream length: 985, is normal: false, short length:896
[12/19/07 14:38:20:435 CET] 00000041 SystemOut O _VBA_PROJECT
[12/19/07 14:38:20:436 CET] 00000041 SystemOut O stream length: 2687, is normal: false, short length:1920
[12/19/07 14:38:20:437 CET] 00000041 SystemOut O PROJECT
[12/19/07 14:38:20:438 CET] 00000041 SystemOut O stream length: 374, is normal: false, short length:4608
[12/19/07 14:38:20:438 CET] 00000041 SystemOut O PROJECTwm
[12/19/07 14:38:20:439 CET] 00000041 SystemOut O stream length: 41, is normal: false, short length:4992
[12/19/07 14:38:20:440 CET] 00000041 SystemOut O SummaryInformation
[12/19/07 14:38:20:440 CET] 00000041 SystemOut O stream length: 260, is normal: false, short length:5056
[12/19/07 14:38:20:441 CET] 00000041 SystemOut O DocumentSummaryInformation
[12/19/07 14:38:20:441 CET] 00000041 SystemOut O stream length: 168, is normal: false, short length:5376
[12/19/07 14:38:20:442 CET] 00000041 SystemOut O short stream length: 5568
[12/19/07 14:38:20:444 CET] 00000041 SystemOut O step mini1
[12/19/07 14:38:20:445 CET] 00000041 SystemOut O stream length: 5568, is normal: true, short length:5568
[12/19/07 14:38:20:446 CET] 00000041 SystemOut O step mini2
[12/19/07 14:38:20:448 CET] 00000041 SystemOut O stream length: 328, is normal: true, short length:5568
[12/19/07 14:38:20:448 CET] 00000041 SystemOut O start: 1977, size: 0
[12/19/07 14:38:20:451 CET] 00000041 SystemOut O stream length: 1536, is normal: true, short length:5568

... and here's the log from local Windows (no errors in saved Excel file):

[19/12/07 14:54:15:055 CET] 00000031 SystemOut O CompObj
[19/12/07 14:54:15:055 CET] 00000031 SystemOut O stream length: 110, is normal: false, short length:0
[19/12/07 14:54:15:055 CET] 00000031 SystemOut O Workbook
[19/12/07 14:54:15:055 CET] 00000031 SystemOut O stream length: 1006556, is normal: true, short length:128
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O dir
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 707, is normal: false, short length:128
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O ThisWorkbook
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 985, is normal: false, short length:896
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O _VBA_PROJECT
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 2687, is normal: false, short length:1920
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O PROJECT
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 374, is normal: false, short length:4608
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O PROJECTwm
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 41, is normal: false, short length:4992
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O SummaryInformation
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 260, is normal: false, short length:5056
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O DocumentSummaryInformation
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 168, is normal: false, short length:5376
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O short stream length: 5568
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O step mini1
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 5568, is normal: true, short length:5568
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O step mini2
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 348, is normal: true, short length:5568
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O start: 1977, size: 1
[19/12/07 14:54:15:148 CET] 00000031 SystemOut O stream length: 1536, is normal: true, short length:5568

Thanks,

Frank.

Hi Frank,

Thanks for the further details

We will check and get back to you soon.

Thank you.

Hi Frank,

Would you please try following code in a simple Java class and compare the result value of local system and server? By the debug message, I think the result maybe different between the local system and AIX serve. Thanks a lot for your patience.

public static void main(String[] args)

{

int[] array = {110,707,985,2687,374,41,260,168,328,348};
System.out.println("getVal1:");
for(int i=0; i<array.length; i++)
{
System.out.println(array[i] + " = " + getVal1(array[i], 64) + ", " + getVal1(array[i], 512));
}

System.out.println("getVal2:");
for(int i=0; i<array.length; i++)
{
System.out.println(array[i] + " = " + getVal2(array[i], 64) + ", " + getVal2(array[i], 512));
}
}
private static int getVal1(long value, int divider)
{
long result = value / divider;
if ((value % divider) != 0)
result++;
return (int)result;
}
private static int getVal2(long value, int divider)
{
return (int)((value+divider-1)/divider);
}

Hi,

Windows / AIX, same results:

getVal1:
110 = 2, 1
707 = 12, 2
985 = 16, 2
2687 = 42, 6
374 = 6, 1
41 = 1, 1
260 = 5, 1
168 = 3, 1
328 = 6, 1
348 = 6, 1

getVal2:
110 = 2, 1
707 = 12, 2
985 = 16, 2
2687 = 42, 6
374 = 6, 1
41 = 1, 1
260 = 5, 1
168 = 3, 1
328 = 6, 1
348 = 6, 1

Frank.