I am getting an exception when I am trying to save and then open a workbook using Aspose APIs. Below is the stack trace:
java.lang.IllegalArgumentException: Invalid sheet index: 65535 at com.aspose.cells.Worksheets.a(Unknown Source) at com.aspose.cells.Worksheets.getSheet(Unknown Source) at com.aspose.cells.ds.d(Unknown Source) at com.aspose.cells.ds.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at com.aspose.cells.Workbook.open(Unknown Source)
I am using Aspose .Cells for Java. I am not able to simulate this issues because I get this error intermittently.
Can you please tell me when can I get this exception?
Normally the exception occures when you try to specify incorrect index for a sheet or the code reaches to and there is an invalid sheet's index in the program. Well, we appreciate if you could create a sample test code to reproduce / simulate the error, then we may be in a better position to figure it out soon.
We are using Aspose.Cells for Java v1.9.5.20 in our QA environment. As mentioned in the thread above, we are not able to replicate the error since it occurs around twice in a week. Out of the 100-150 jobs that we submit for generating Excel workbooks, the 2-3 jobs fail. We feel that during these jobs, there may be some API that we are calling which results in such an error.
Amjadās response above says that we may be passing an invalid sheet index. But if you see the stack trace above, we are calling the workbook.open method on an existing .xls file created by Aspose. When we try reopening the same file through a standalone program, it works.
Since this exception is coming from the Aspose code, can you please provide us with pointers to get you a trace file that will help you in bug simulation. We will execute those steps in our QA environment here.
Was the template file which be opened by Aspose.Cells and cause this issue an existed Excel file? Or it was dynamically created by your application with Aspose.Cells APIs too? If it was an existed file, I think you can send it to us so we can check and try to reproduce such issue, for safety, you can email it to me using the approach mentioned in http://www.aspose.com/corporate/purchase/faqs/send-license-to-aspose-staff.aspx . If it was dynamically created by your application, please check whethere your application creates it exactly same when it be opened successfully or with failure.
Another question, did the stack trace generated by Aspose.Cells for Java v1.9.5.20? It seems the trace did not coincide with this version. Anyway, if you can not provide the template file which cause this issue when open it, I am afraid there is no better way to trace it than adding some debug to try to trace more.
In this attached version, I have added some debug codes at the position where I think is the most possible place may cause such issue, if the program run into this debug block, there will be an log file named "AsposeDebug_SN" being created at the current path relative to you application. Wish we can get some more details if you use this version with your application so we can trace this issue, thank you.