473,231 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Please Help, POI and Excel

Dan
Hello,

I am trying to read and write to an Excel file via my Java applet. I
have done so successfully on several simple Excel files that simply
had data cells without many complicated equations or any other Excel
extras. However, now is the time to get the complicated ones to work.
I didn't think that there would be a difference, but there is. At
first, I was beginning to think that it was a file size problem, but
now I am unsure. Does anyone know if there are any restrictions on
POI? How about some good reference info, asside from the java doc?

Here is some more info. Currently, the excel file is 6 sheets with
many complicated formulas as well as a few add ins including a fairly
complex solver. There will be more added to it later, which worries
me even more. It will also interact with some VB in the future.

However, I can not load the file at all. When I run the following
lines:

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
HSSFWorkbook wb = new HSSFWorkbook(fs, false);

I get the following exception on the second line:

[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)

java.lang.reflect.InvocationTargetException:
java.lang.ArrayIndexOutOfBoundsException
at org.apache.poi.util.LittleEndian.getNumber(LittleE ndian.java:557)
at org.apache.poi.util.LittleEndian.getShort(LittleEn dian.java:90)
at org.apache.poi.hssf.record.formula.NamePtg.<init>( NamePtg.java:100)
at org.apache.poi.hssf.record.formula.Ptg.createPtg(P tg.java:259)
at org.apache.poi.hssf.record.FormulaRecord.getParsed ExpressionTokens(FormulaRecord.java:171)
at org.apache.poi.hssf.record.FormulaRecord.fillField s(FormulaRecord.java:147)
at org.apache.poi.hssf.record.Record.fillFields(Recor d.java:143)
at org.apache.poi.hssf.record.Record.<init>(Record.ja va:105)
at org.apache.poi.hssf.record.FormulaRecord.<init>(Fo rmulaRecord.java:118)
at java.lang.reflect.Constructor.newInstance(Native Method)
at org.apache.poi.hssf.record.RecordFactory.createRec ord(RecordFactory.java:254)
at org.apache.poi.hssf.record.RecordFactory.createRec ords(RecordFactory.java:192)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>( HSSFWorkbook.java:191)
at scheduling.util.ExcelSheet.loadExcel(ExcelSheet.ja va:174)

I found the sheet that causes the problem, however I have no idea why.
When I delete all the cells in the sheet, it passes through this
part, but crashes further down the line. I tried deleting cells in
groups, trying to determine which cell or cells are causing the
problem, but it doesn't work because, in my opinion, the equations
rely on cells that I deleted.

Is there a way to run a debugger to determine where it is having a
problem? What about in the future, how will I be able to figure out
the next hurdle? There must be some good resources on this subject, I
just can't find any ... anyone know of any?

If you wish, please feel free to contact me via email at
zg***@planitusa.com. I have figured out how to use POI in a
relatively simple manner, but now I am at a loss. Please Help.

Dan
Jul 17 '05 #1
1 11002
Hi Dan,

I tried using the POI for a similar thing but ran into some serious
roadblocks regarding complex formulas.
The POI as it currently exists can only evaluate formulas that return
numeric values. There are other limitations on the POI site that are
clearly documented on their website.

If you really need to open a Micro$oft file, there's no better way than to
use a Micro$oft development environment.
Also consider that an applet cannot (without some security hassles) open
files on a file system other than where the applet was loaded from. So
unless your Excel file is on the webserver where a user will load the web
page containing the applet, you're out of luck. I have seen examples on the
microsoft site (and written some of my own) using JScript to manipulate
Excel file on the user's local workstation. I don't know your particular
requirements, but it may be an option.

Cheers,

Mark Voorberg
www.objectclarity.com

"Dan" <zh******@yahoo.com> wrote in message
news:75**************************@posting.google.c om...
Hello,

I am trying to read and write to an Excel file via my Java applet. I
have done so successfully on several simple Excel files that simply
had data cells without many complicated equations or any other Excel
extras. However, now is the time to get the complicated ones to work.
I didn't think that there would be a difference, but there is. At
first, I was beginning to think that it was a file size problem, but
now I am unsure. Does anyone know if there are any restrictions on
POI? How about some good reference info, asside from the java doc?

Here is some more info. Currently, the excel file is 6 sheets with
many complicated formulas as well as a few add ins including a fairly
complex solver. There will be more added to it later, which worries
me even more. It will also interact with some VB in the future.

However, I can not load the file at all. When I run the following
lines:

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
HSSFWorkbook wb = new HSSFWorkbook(fs, false);

I get the following exception on the second line:

[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)
[WARNING] Unknown Ptg 3c (60)

java.lang.reflect.InvocationTargetException:
java.lang.ArrayIndexOutOfBoundsException
at org.apache.poi.util.LittleEndian.getNumber(LittleE ndian.java:557)
at org.apache.poi.util.LittleEndian.getShort(LittleEn dian.java:90)
at org.apache.poi.hssf.record.formula.NamePtg.<init>( NamePtg.java:100)
at org.apache.poi.hssf.record.formula.Ptg.createPtg(P tg.java:259)
at org.apache.poi.hssf.record.FormulaRecord.getParsed ExpressionTokens(FormulaRe
cord.java:171) at org.apache.poi.hssf.record.FormulaRecord.fillField s(FormulaRecord.java:147) at org.apache.poi.hssf.record.Record.fillFields(Recor d.java:143)
at org.apache.poi.hssf.record.Record.<init>(Record.ja va:105)
at org.apache.poi.hssf.record.FormulaRecord.<init>(Fo rmulaRecord.java:118)
at java.lang.reflect.Constructor.newInstance(Native Method)
at org.apache.poi.hssf.record.RecordFactory.createRec ord(RecordFactory.java:254
) at org.apache.poi.hssf.record.RecordFactory.createRec ords(RecordFactory.java:19
2) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>( HSSFWorkbook.java:191) at scheduling.util.ExcelSheet.loadExcel(ExcelSheet.ja va:174)

I found the sheet that causes the problem, however I have no idea why.
When I delete all the cells in the sheet, it passes through this
part, but crashes further down the line. I tried deleting cells in
groups, trying to determine which cell or cells are causing the
problem, but it doesn't work because, in my opinion, the equations
rely on cells that I deleted.

Is there a way to run a debugger to determine where it is having a
problem? What about in the future, how will I be able to figure out
the next hurdle? There must be some good resources on this subject, I
just can't find any ... anyone know of any?

If you wish, please feel free to contact me via email at
zg***@planitusa.com. I have figured out how to use POI in a
relatively simple manner, but now I am at a loss. Please Help.

Dan

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: NRB | last post by:
Dear friends, Please help me.I am new to VBA programming in access.I need to open a query in MS access database and send those data to a existing excel sheet with the formulas. Please help me...
1
by: eieiohh | last post by:
I'm pulling my hair our... Table Name=Excel Form = freports I am trying to run a Select statement from the Excel table where the datareceived date is between (and including ) the dates on my...
1
by: Flack | last post by:
Hello, When the user of my app selects some rows from an open excel file and drag-n-drops them onto my form, I need to be able to parse those lines and create a datatable that would match the...
2
by: Business Information Systems, Inc. | last post by:
I keep receiving the following error when I try to access Office XP Excel through VB.Net on a web form. I have loaded and registered the Microsoft Office XP PIAs. I have added a reference in...
4
by: Ivan | last post by:
Hi All, I have tried to automate excel in vb.net and i found a problem that i can't find the solution in anywhere... i hope someone can help me in this group.... the problem is i try using...
2
by: shapper | last post by:
Hello, I am for days trying to apply a XSL transformation to a XML file and display the result in a the browser. I am using Asp.Net 2.0. Please, could someone post just a simple code example,...
0
by: nit22 | last post by:
If I find the data in excel through word vba in mac, the find statement automaticaly closed the word document. But this coding is working in Excel vba. I don't know the problem please help me. ...
4
by: ALaurie10 | last post by:
I am somewhat familar with access, but have no clue to modules and coding. I am trying to develop code or a module that will enable a user to import a specific excel spreadsheet and its' data into a...
0
by: santu07 | last post by:
I am trying to export data from Excel11.0 object to datatable using C#. I can't properly open workbooks. Can anyone please help me to fix this error. I got the above error when i try to open the...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.