473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.refle ct.InvocationTa rgetException:
java.lang.Array IndexOutOfBound sException
at org.apache.poi. util.LittleEndi an.getNumber(Li ttleEndian.java :557)
at org.apache.poi. util.LittleEndi an.getShort(Lit tleEndian.java: 90)
at org.apache.poi. hssf.record.for mula.NamePtg.<i nit>(NamePtg.ja va:100)
at org.apache.poi. hssf.record.for mula.Ptg.create Ptg(Ptg.java:25 9)
at org.apache.poi. hssf.record.For mulaRecord.getP arsedExpression Tokens(FormulaR ecord.java:171)
at org.apache.poi. hssf.record.For mulaRecord.fill Fields(FormulaR ecord.java:147)
at org.apache.poi. hssf.record.Rec ord.fillFields( Record.java:143 )
at org.apache.poi. hssf.record.Rec ord.<init>(Reco rd.java:105)
at org.apache.poi. hssf.record.For mulaRecord.<ini t>(FormulaRecor d.java:118)
at java.lang.refle ct.Constructor. newInstance(Nat ive Method)
at org.apache.poi. hssf.record.Rec ordFactory.crea teRecord(Record Factory.java:25 4)
at org.apache.poi. hssf.record.Rec ordFactory.crea teRecords(Recor dFactory.java:1 92)
at org.apache.poi. hssf.usermodel. HSSFWorkbook.<i nit>(HSSFWorkbo ok.java:191)
at scheduling.util .ExcelSheet.loa dExcel(ExcelShe et.java: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 11045
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.goo gle.com...
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.refle ct.InvocationTa rgetException:
java.lang.Array IndexOutOfBound sException
at org.apache.poi. util.LittleEndi an.getNumber(Li ttleEndian.java :557)
at org.apache.poi. util.LittleEndi an.getShort(Lit tleEndian.java: 90)
at org.apache.poi. hssf.record.for mula.NamePtg.<i nit>(NamePtg.ja va:100)
at org.apache.poi. hssf.record.for mula.Ptg.create Ptg(Ptg.java:25 9)
at org.apache.poi. hssf.record.For mulaRecord.getP arsedExpression Tokens(FormulaR e
cord.java:171) at org.apache.poi. hssf.record.For mulaRecord.fill Fields(FormulaR ecord.java:147) at org.apache.poi. hssf.record.Rec ord.fillFields( Record.java:143 )
at org.apache.poi. hssf.record.Rec ord.<init>(Reco rd.java:105)
at org.apache.poi. hssf.record.For mulaRecord.<ini t>(FormulaRecor d.java:118)
at java.lang.refle ct.Constructor. newInstance(Nat ive Method)
at org.apache.poi. hssf.record.Rec ordFactory.crea teRecord(Record Factory.java:25 4
) at org.apache.poi. hssf.record.Rec ordFactory.crea teRecords(Recor dFactory.java:1 9
2) at org.apache.poi. hssf.usermodel. HSSFWorkbook.<i nit>(HSSFWorkbo ok.java:191) at scheduling.util .ExcelSheet.loa dExcel(ExcelShe et.java: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
1404
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 with the code.Can anyone pst a code.I need the data to be transferred to the existing excel sheet as that sheet contains many formulas. Thanks Nithin
1
1220
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 freports form... Can anyone tell me what I am missing here. ......" From Excel " & _
1
1424
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 original selected Excel rows. Is there any way the I can create a DataTable from CSV that is just droppped onto the form? I tried parsing each line myself, using some regular expressions I found
2
5509
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 the COM section to: Microsoft ActiveX Data Objects 2.7 Library Microsoft ActiveX Plugin Microsoft Excel 10.0 Object Library Microsoft Office XP Web Components
4
1843
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 the excel function -- 'Excel.Workbooks.Open("C:\Filename.xls")' it pops up an error msg -- 'object reference not set to an instance of an object'
2
1969
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, either C# or VB.NET, that I can try. Thank You Very Much,
0
1074
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. Coding : Dim wb As Excel.Application Set wb = New Excel.Application wb.Workbooks.Open (fullnameofxls) wb.activeworkbook.Activate
4
2044
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 table by pressing a command button. I am able to import excel, however it will not attach to existing spreadsheet. I find myself, having to build an append query for each import which is time consuming and inefficient. I have already checked, my...
0
1443
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 Workbooks.Open(___,____, ). I am Beginner So kindly help me. Here is the code: String strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strpath + ";" + "Extended Properties=Excel 8.0;"; ...
0
9384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9212
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9973
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8645
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.