You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Chris Lott <ma...@invest-faq.com> on 2009/04/27 12:01:20 UTC

Bad link to the XLS2CSVrma.java example

Hi and thanks for POI, it is a big help.  I am writing to report a minor 
problem in a documentation page:

http://poi.apache.org/spreadsheet/how-to.html

This page discusses "Record Aware Event API (HSSF Only)" and offers an 
XLS2CSV example program.  It gives this link to retrieve the code from 
subversion but that link is broken:

http://svn.apache.org/repos/asf/poi/trunk/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/

I found the code here:

http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java

The text above the link indicates that the example code was previously 
in the scratchpad area but no longer; maybe just the link needs to be 
updated.

Hope this helps and thanks for listening.

chris...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Bad link to the XLS2CSVrma.java example

Posted by Chris Lott <ma...@invest-faq.com>.
Nick Burch wrote:
> On Mon, 27 Apr 2009, Chris Lott wrote:
>> This page discusses "Record Aware Event API (HSSF Only)" and offers an 
>> XLS2CSV example program.  It gives this link to retrieve the code from 
>> subversion but that link is broken:
> 
> Thanks for spotting this, I've fixed the docs, and the update should be 
> on the site in an hour or so
> 
> Cheers
> Nick

Thanks for the quick response.  I see the website page has been updated 
so the text no longer discusses the scratchpad area as the primary home 
of this little program, but the link with text "subversion" still *does* 
point to a scratchpad area, and does not work.  Please check it, thanks.

chris...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Bad link to the XLS2CSVrma.java example

Posted by Nick Burch <ni...@torchbox.com>.
On Mon, 27 Apr 2009, Chris Lott wrote:
> This page discusses "Record Aware Event API (HSSF Only)" and offers an 
> XLS2CSV example program.  It gives this link to retrieve the code from 
> subversion but that link is broken:

Thanks for spotting this, I've fixed the docs, and the update should be on 
the site in an hour or so

Cheers
Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: AbortableHSSFListener and HSSFRequest#processRecord(Record) to read first row of Excel sheet

Posted by Chris Lott <ma...@invest-faq.com>.
Nick Burch wrote:
> On Tue, 5 May 2009, Chris Lott wrote:
>> Hi, I'm writing to report a small documentation problem in the class 
>> org.apache.poi.hssf.eventusermodel.AbortableHSSFListener
> 
> I've fixed the docs, and added a unit test that shows it all works just 
> fine
> 
> Nick


Thank you very much for the fast reply.    I see the change to 
AbortableHSSFListener in svn.  For what it's worth the email address 
careysub at earthling.net that appears in that file is not working.

Anyhow I would very much like to look at your testcase so I can see what 
I was doing wrong, but cannot seem to find it.  I looked on 
svn.apache.org in the packages below 
/repos/asf/poi/trunk/src/testcases/org/apache/poi/hssf/.  It seems to me 
it belongs there, in the eventusermodel package (??).  Any pointers to 
the right place will be much appreciated, thanks!!

chris...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: AbortableHSSFListener and HSSFRequest#processRecord(Record) to read first row of Excel sheet

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 5 May 2009, Chris Lott wrote:
> I am extending it to read just the first row of an Excel sheet.  In this 
> example, the user implementation of HSSFListener is wrapped inside a 
> MissingRecordAwareHSSFListener, which in turn is wrapped inside a 
> FormatTrackingHSSFListener.

Yup, it's all hung off HSSFListener, not AbortableHSSFListener (which 
personally I'm not all that keen on the API of, but it's a bit late to 
change that now...)

OOI, can you not just throw a custom exception in processRecord once 
you're done, and catch that further up?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: AbortableHSSFListener and HSSFRequest#processRecord(Record) to read first row of Excel sheet

Posted by Chris Lott <ma...@invest-faq.com>.
Nick Burch wrote:
> On Tue, 5 May 2009, Chris Lott wrote:
>> Hi, I'm writing to report a small documentation problem in the class 
>> org.apache.poi.hssf.eventusermodel.AbortableHSSFListener
> 
> I've fixed the docs, and added a unit test that shows it all works just 
> fine
> 
> Nick

Thanks for checking that this works.  I think I found the problem.  I am 
still working with the XLS2CSV example from here

http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java

I am extending it to read just the first row of an Excel sheet.  In this 
example, the user implementation of HSSFListener is wrapped inside a 
MissingRecordAwareHSSFListener, which in turn is wrapped inside a 
FormatTrackingHSSFListener.   The dummy end-of-row record provided by 
the MissingRecordAwareHSSFListener is really helpful, and the formatting 
assistance provided by the FormatTrackingHSSFListener is *also* really 
helpful.  But those two listeners don't seem to be aware of the 
abortable notion.  I revised the implementation so it extends 
AbortableHSSFListener (instead of implementing HSSFListener), but the 
two wrapper listeners don't call abortableProcessRecord.  Instead they 
call just plain old processRecord.  At first glance there seems no way 
for me to reuse all this great stuff and still get the message back up 
to the loop.  I am trying to figure out a way around this issue.  Thanks 
for listening.

chris...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: AbortableHSSFListener and HSSFRequest#processRecord(Record) to read first row of Excel sheet

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 5 May 2009, Chris Lott wrote:
> Hi, I'm writing to report a small documentation problem in the class 
> org.apache.poi.hssf.eventusermodel.AbortableHSSFListener

I've fixed the docs, and added a unit test that shows it all works just 
fine

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


AbortableHSSFListener and HSSFRequest#processRecord(Record) to read first row of Excel sheet

Posted by Chris Lott <ma...@invest-faq.com>.
Hi, I'm writing to report a small documentation problem in the class 
org.apache.poi.hssf.eventusermodel.AbortableHSSFListener, and possible 
related bug.  The javadoc that states the class is an interface, but the 
code declares itself to be an abstract class.  Because it's not an 
interface, code in HSSFRequest might not be working per your expectations.

Here's the long version:

I am trying to solve the same problem that was discussed years ago on 
the POI users list, namely reading 1 row from excel file:

http://mail-archives.apache.org/mod_mbox/poi-user/200608.mbox/%3COFA72D53DE.1F179A06-ON862571D9.004D5826-862571D9.004E2111@swbc.com%3E

I too have hit situations in which POI blows up the JVM with an 
out-of-memory error.  I confess I'm using the default -mx128Mb JVM args, 
which many of you will probably laugh at, but I don't want or need to 
have the whole thing in memory.

So the event user model seems the perfect solution to this problem, 
especially when I discovered the AbortableHSSFListener feature.  My 
design is as follows: open the file, process records until the first row 
is complete, then have the abortableProcessRecord() method return 
nonzero to tell the HSSFEventFactory to stop processing.

What I see is that my abortableProcessRecord(Record) method is never 
called.  I looked into HSSFRequest at the processRecord(Record) method, 
and I see that it checks whether the listener is an instance of 
AbortableHSSFListener.  But that's an abstract class (not an interface), 
so I suspect the test always fails, and that just might explain why my 
code does not work.

I am sending this to the poi user list, wich cc to the email addresses 
that I found in the headers of those classes, I hope that is the right 
thing to do.  Please reply, and thanks for your time!!

chris...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org