Getting the ArrayIndexOutOfBoundsException: 0 -- MS2010 XLSX to PDF Conversion in Oracle Application Server

Hi Aravind,


Thank you for your help.
I have attached the sample input and output files along with the log files to the ticket associated with this thread. Hopefully soon we will get back to you on this after analysing the logs.

Hi,

From your new log information, we think the exception is now caused by the invalid pdf file which may be created by your code like


workbook.save("/apps/ge/stamp.pdf", FileFormatType.PDF);


Previous exceptions was caused by Workbook.open() method and we have caught it in the new fix. As we had said, it seems that there are some other problems while reading/saving files in your environment with aspose.cells component. But it is really hard for us to figure the issue out because we have no such environment to reproduce the issue. We have tested your template file with oc4j server, the file can be read and re-saved fine. To trace the issue, would you please check whether the data has been read successfully from your template file? Such as, add some output in your code like:

Java

Workbook workbook = new Workbook();
workbook.open("/apps/ge/stamp.xls");
Cells cells = workbook.getWorksheets().getSheet(0).getCells();
for(int i=0; i<6; i++) {
Cell cell= cells.getCell(i, 0);
System.out.println(cell.getName() + ":" + cell.getValue()); }
SaveOptions saveop = workbook.getSaveOptions();
saveop.setOnePagePerSheet(true);
saveop.setFontPath(new String[]{"/apps/ge"});
workbook.save("/apps/ge/stamp.pdf", FileFormatType.PDF);


Hi,

We have executed the code. Please refer to the attached log file, xlsx and pdf file. Do let me know if you need anything else.Looks like there is a problem with reading the text from the xlsx file.

Thanks
Aravind

Hi,

Thanks for your feedback. I have logged your comment. We will look into this issue and update you asap.

The comment has been logged inside the issue id: CELLSJAVA-28609

Hi,

From your new log file we can see that no cells data be read successfully from the template file. Just same as we have thought, there are other problems in the read process. Also there must be some problems with the save process too because your generated pdf is corrupted too. Commonly even an empty workbook, the generated pdf file should not be corrupted. Sot we think there may be some compatibility problems for your server and the jars of aspose. Unfortunately we have no such kind of environment to reproduce and trace the issue. So we have to provide some other debug versions and ask your help to execute it and send us back the debug messages.

Please download: aspose-cells-2.5.4.10D.jar

Hi,

Applied the patch and attached are the log file, xlsx and pdf files.

Aravind

Hi,

Thanks for your feedback and files. We have saved it in our log and after investigating it, we will update you asap.

Hi,

Please try this new debug version (V2.5.4.12D) and send us the output messages. It seems those string values used by cells have not been processed by dom4j’s handler.

Please download: aspose-cells-2.5.4.12D.zip

Thanks Faiz! Its working now, but we need to test more and will get back to you.

Could you also look into the other issue which we reported?

<A href="https://forum.aspose.com/t/86114</A></P> <P>This is same problem with PPTX. Hope this can be resolved quickly as XSLX issue is resolved now.</P> <P>Thanks!</P> <P>Aravind</P> <P> </P>

Hi,

Its good things are going ok so far.

For your Aspose.Slides problem, I am afraid, you will have to post your request on the Aspose.Slides forum.

Aspose.Slides support team will help you asap.

Hi,

Thank you for your feedback and we are glad to know that your issue may be resolved in some way. However, we still need your help to trace this issue further so that we can get the root cause of it and get the best way to remove all potential issues of same kind. So please use this new debug version(V2.5.4.12D1) in your application and check whether it can work, also please send us back the output message. When we find the root cause of this issue, we can also share our findings with slides team so that your similar issue with pptx may be resolved too.

Hi,

I have tested with the following jar files and below are the findings

Case 1

Initial jar file aspose-cells-2.5.2.jar.

This works with XLS and data is copied correctly. Does not work with XLSX.

Case 2

With aspose-cells-2.5.4.12D.jar

This file works for both XLS and XLSX, but data is truncated(all files attached). As you see there are four columns in the xls and xlsx where as final output pdf has truncated fourth column.

Case 3

With aspose-cells-2.5.4.12D1.jar I got the error

java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.resetHandlers()V

I am using dom4j-1.6.1.jar file

Thanks

Aravind

Hi,

It is really strange that you got such kind of error: “java.lang.NoSuchMethodError: org.dom4j.io.SAXReader.resetHandlers()V”. From dom4j-1.6.1’s source code, jar file or javadoc you can see this method is there and we cannot find any issue with this method in our test.

So please make sure you are using the correct version of dom4j, and please test the debug version aspose-cells-2.5.4.12D1.jar in a standalone application(out of the OAS) to see whether this method can work.

At the same time, we removed the invocation of this method in the new debug version (aspose-cells-2.5.4.12D2.jar) to make the trace process forward. Please try it and send us back the debug messages.

Anyways it will be better if you can figure out the issue of “SAXReader.resetHandlers()” at your end at the same time.

For the issue that data was truncated, it is a bug of exporting pdf. We will fix it soon.

Hi,

Regarding the error NoSuchMethodError, I think OAS is using another version of dom4j jar which is not same as this one. Hence I cannot remove the jar because the code should work in OAS and if I remove default dom4j from OAS, it may create more problem. Pls continue working with aspose-cells-2.5.4.12D2.jar.

I have applied patch and below is the log. Also attached are the two files: Source file and stamped file

11/07/12 18:33:15 2.5.4.12D2-1: total si count 1

11/07/12 18:33:15 2.5.4.12D2-1:TEST FILE FOR STAMPING

11/07/12 18:33:15 start: /sst

11/07/12 18:33:15 start: /sst/si

11/07/12 18:33:15 start: /sst/si/t

11/07/12 18:33:15 end: /sst/si/t

11/07/12 18:33:15 end: /sst/si

11/07/12 18:33:15 end: /sst

11/07/12 18:33:15 2.5.4.12D2-2: total si count 1

11/07/12 18:33:15 2.5.4.12D2-2:TEST FILE FOR STAMPING

11/07/12 18:33:15 2.5.4.12D2-3: total si count 1

11/07/12 18:33:15 2.5.4.12D2-3:TEST FILE FOR STAMPING

11/07/12 18:33:15 A1:TEST FILE FOR STAMPING

11/07/12 18:33:15 A2:TEST FILE FOR STAMPING

11/07/12 18:33:15 A3:TEST FILE FOR STAMPING

11/07/12 18:33:15 A4:TEST FILE FOR STAMPING

11/07/12 18:33:15 A5:TEST FILE FOR STAMPING

11/07/12 18:33:15 A6:TEST FILE FOR STAMPING

Thanks

Aravind

Hi,

We think the root cause of this issue is of your dom4j version used by OAS. Obviously this version does not support some features provided by dom4j 1.6.1 version. Now that the debug version can work for you, we have changed our comonent in that way to make it be compatible with your enviornment and so that you need not to change the dom4j for OAS. Also we have fixed the issue that cell content be truncated when converting to pdf. Please try this new fix.

Please download: Aspose.Cells for Java v2.5.4.13

The issue related to truncation of data is resolved. Could you let us know the root cause on why the initial version did not work with OAS? How are you planning to incorporate this fix in future versions?

Hi,


We will check if we can let you know the root cause of the issue soon.

Regarding next official release of the product, well, you can use this hot fix for your production server for your requirements as long as you wish; it will behave like an official release, it contains full fledged features/functionality. It is an intermediate kind of version which is provided as a fix against some bugs or new features/enhancements. Normally, a bug fix version is posted in the support forums. Moreover, it is to be noted that our next official release (that is scheduled to be released after at least 3 weeks or so (it depends)) would include all the functionality of the previous fixes (including the latest one too).

Thank you.

Hi,

For the root cause of this issue, as we have said in previous reply, we think it should be the dom4j version used by your OAS.

By debug versions, we found your dom4j used by OAS cannot support some features that should be supported by dom4j_1.6.1 version, such as SAXReader.resetHandler()/removeHandler() and so on.

To be compatible with your OAS environment, we have to instantiate a new SAXReader for every xml parsing instead of the way we used in prior versions(reusing one SAXReader object to parse multiple xml files). Anyways, if the newest fix can resolve your issue, we will keep this way in later versions/fixes.

Shakeel, We found another issue with the stamping. It overlaps Header and footer. Attached is the output of sample xlsx.

Hi,

Please also provide the sample xlsx file that you converted to pdf using Aspose.Cells for Java. We will look into it asap.