You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Rommel Sharma <ro...@mahindrabt.com> on 2003/12/01 11:25:24 UTC

Getting number of rows

Hi,
 In the eventmodel POI API, how can we get the total number of rows?
 Is there an equivalent of a method in the usermodel api like getLastRowNum() of HSSFSheet?
Thanks,
Rommel.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com


AW: Getting number of rows

Posted by "karl-heinz (SAW)" <ka...@sawag.com>.
Hi Rommel.

Thanks for the feedback.

MfG 
Karl-Heinz Zengerle
___________________________________________________
 More than competence in Document Management 
___________________________________________________
SAW AG
Waldmünchenerstr. 12
81549 München
Tel.: ++49-89-68088368
Fax: ++49-89-68088389
www.sawag.com

___________________________________________________

-----Ursprüngliche Nachricht-----
Von: Rommel Sharma [mailto:rommels@mahindrabt.com] 
Gesendet: Montag, 1. Dezember 2003 13:18
An: POI Users List
Betreff: Re: Getting number of rows

Just checked DimensionsRecord (subclass of Record) and  I did find how
to
detect the number of rows, going through the POI API:
Here's the code...

    public void processRecord(Record record)
    {
          if(record.getSid()==DimensionsRecord.sid)
          {
             DimensionsRecord dr =  new DimensionsRecord();
             dr=(DimensionsRecord)record;
             System.out.println("The last row number is:
"+dr.getLastRow());
          }
    ...
    ...
  }

Regards,
Rommel.
----- Original Message -----
From: "karl-heinz (SAW)" <ka...@sawag.com>
To: "'POI Users List'" <po...@jakarta.apache.org>
Sent: Monday, December 01, 2003 5:10 PM
Subject: AW: Getting number of rows

> Hi Rommel.
>
> I think that's hand coding. I think null rows you can omit. Null cells
> you'll have to treat like cells containing empty strings. My
experience
> is that the behaviour is different when files are changed, e.g.
several
> entries are deleted.
>
> When you put all default values for mandatory fields to the record and
> then overwrite those things which are given you should have the
desired
> result.
>
> MfG
> Karl-Heinz Zengerle
> ___________________________________________________
>  More than competence in Document Management
> ___________________________________________________
> SAW AG
> Waldmünchenerstr. 12
> 81549 München
> Tel.: ++49-89-68088368
> Fax: ++49-89-68088389
> www.sawag.com
>
> ___________________________________________________
>
> -----Ursprüngliche Nachricht-----
> Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> Gesendet: Montag, 1. Dezember 2003 12:29
> An: POI Users List
> Betreff: Re: Getting number of rows
>
> Hi Karl,
> Thank You.
> Actually I am validating an excel file where there could be thousands
of
> records also.
> Some of the fields under some headers are mandatory. We have to detect
> the
> missing fields and at the same time add each row in a vector.
> So I want to detect when a new row starts, and I also want to detect a
> cell
> with no value, so that I can put some default value for it in my
vector.
> I am not able to know when a new row starts which is important to
create
> the
> next Vector element.
> Is there any class using which I can know, now the row  has started...
> regards,
> Rommel.
>
> ----- Original Message -----
> From: "karl-heinz (SAW)" <ka...@sawag.com>
> To: "'POI Users List'" <po...@jakarta.apache.org>
> Sent: Monday, December 01, 2003 4:01 PM
> Subject: AW: Getting number of rows
>
> > Hi Rommel.
> >
> > You can retrieve the number of sheets and per sheet you can retrieve
> the
> > number of rows.
> >
> > The function you'll have to code (summarize over all sheets the
> numbers
> > of rows.
> >
> > Be careful:
> > Also empty lines are contained (null rows). Maybe you want to ignore
> > such lines when counting.
> >
> > MfG
> > Karl-Heinz Zengerle
> > ___________________________________________________
> >  More than competence in Document Management
> > ___________________________________________________
> > SAW AG
> > Waldmünchenerstr. 12
> > 81549 München
> > Tel.: ++49-89-68088368
> > Fax: ++49-89-68088389
> > www.sawag.com
> >
> > ___________________________________________________
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> > Gesendet: Montag, 1. Dezember 2003 11:25
> > An: poi-user@jakarta.apache.org
> > Betreff: Getting number of rows
> >
> > Hi,
> >  In the eventmodel POI API, how can we get the total number of rows?
> >  Is there an equivalent of a method in the usermodel api like
> > getLastRowNum() of HSSFSheet?
> > Thanks,
> > Rommel.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com




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


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


Re: Getting number of rows

Posted by Rommel Sharma <ro...@mahindrabt.com>.
Just checked DimensionsRecord (subclass of Record) and  I did find how to
detect the number of rows, going through the POI API:
Here's the code...

    public void processRecord(Record record)
    {
          if(record.getSid()==DimensionsRecord.sid)
          {
             DimensionsRecord dr =  new DimensionsRecord();
             dr=(DimensionsRecord)record;
             System.out.println("The last row number is: "+dr.getLastRow());
          }
    ...
    ...
  }

Regards,
Rommel.
----- Original Message -----
From: "karl-heinz (SAW)" <ka...@sawag.com>
To: "'POI Users List'" <po...@jakarta.apache.org>
Sent: Monday, December 01, 2003 5:10 PM
Subject: AW: Getting number of rows

> Hi Rommel.
>
> I think that's hand coding. I think null rows you can omit. Null cells
> you'll have to treat like cells containing empty strings. My experience
> is that the behaviour is different when files are changed, e.g. several
> entries are deleted.
>
> When you put all default values for mandatory fields to the record and
> then overwrite those things which are given you should have the desired
> result.
>
> MfG
> Karl-Heinz Zengerle
> ___________________________________________________
>  More than competence in Document Management
> ___________________________________________________
> SAW AG
> Waldmünchenerstr. 12
> 81549 München
> Tel.: ++49-89-68088368
> Fax: ++49-89-68088389
> www.sawag.com
>
> ___________________________________________________
>
> -----Ursprüngliche Nachricht-----
> Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> Gesendet: Montag, 1. Dezember 2003 12:29
> An: POI Users List
> Betreff: Re: Getting number of rows
>
> Hi Karl,
> Thank You.
> Actually I am validating an excel file where there could be thousands of
> records also.
> Some of the fields under some headers are mandatory. We have to detect
> the
> missing fields and at the same time add each row in a vector.
> So I want to detect when a new row starts, and I also want to detect a
> cell
> with no value, so that I can put some default value for it in my vector.
> I am not able to know when a new row starts which is important to create
> the
> next Vector element.
> Is there any class using which I can know, now the row  has started...
> regards,
> Rommel.
>
> ----- Original Message -----
> From: "karl-heinz (SAW)" <ka...@sawag.com>
> To: "'POI Users List'" <po...@jakarta.apache.org>
> Sent: Monday, December 01, 2003 4:01 PM
> Subject: AW: Getting number of rows
>
> > Hi Rommel.
> >
> > You can retrieve the number of sheets and per sheet you can retrieve
> the
> > number of rows.
> >
> > The function you'll have to code (summarize over all sheets the
> numbers
> > of rows.
> >
> > Be careful:
> > Also empty lines are contained (null rows). Maybe you want to ignore
> > such lines when counting.
> >
> > MfG
> > Karl-Heinz Zengerle
> > ___________________________________________________
> >  More than competence in Document Management
> > ___________________________________________________
> > SAW AG
> > Waldmünchenerstr. 12
> > 81549 München
> > Tel.: ++49-89-68088368
> > Fax: ++49-89-68088389
> > www.sawag.com
> >
> > ___________________________________________________
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> > Gesendet: Montag, 1. Dezember 2003 11:25
> > An: poi-user@jakarta.apache.org
> > Betreff: Getting number of rows
> >
> > Hi,
> >  In the eventmodel POI API, how can we get the total number of rows?
> >  Is there an equivalent of a method in the usermodel api like
> > getLastRowNum() of HSSFSheet?
> > Thanks,
> > Rommel.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com




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


AW: Getting number of rows

Posted by "karl-heinz (SAW)" <ka...@sawag.com>.
Hi Rommel.

I think that's hand coding. I think null rows you can omit. Null cells
you'll have to treat like cells containing empty strings. My experience
is that the behaviour is different when files are changed, e.g. several
entries are deleted.

When you put all default values for mandatory fields to the record and
then overwrite those things which are given you should have the desired
result.

MfG 
Karl-Heinz Zengerle
___________________________________________________
 More than competence in Document Management 
___________________________________________________
SAW AG
Waldmünchenerstr. 12
81549 München
Tel.: ++49-89-68088368
Fax: ++49-89-68088389
www.sawag.com

___________________________________________________

-----Ursprüngliche Nachricht-----
Von: Rommel Sharma [mailto:rommels@mahindrabt.com] 
Gesendet: Montag, 1. Dezember 2003 12:29
An: POI Users List
Betreff: Re: Getting number of rows

Hi Karl,
Thank You.
Actually I am validating an excel file where there could be thousands of
records also.
Some of the fields under some headers are mandatory. We have to detect
the
missing fields and at the same time add each row in a vector.
So I want to detect when a new row starts, and I also want to detect a
cell
with no value, so that I can put some default value for it in my vector.
I am not able to know when a new row starts which is important to create
the
next Vector element.
Is there any class using which I can know, now the row  has started...
regards,
Rommel.

----- Original Message -----
From: "karl-heinz (SAW)" <ka...@sawag.com>
To: "'POI Users List'" <po...@jakarta.apache.org>
Sent: Monday, December 01, 2003 4:01 PM
Subject: AW: Getting number of rows

> Hi Rommel.
>
> You can retrieve the number of sheets and per sheet you can retrieve
the
> number of rows.
>
> The function you'll have to code (summarize over all sheets the
numbers
> of rows.
>
> Be careful:
> Also empty lines are contained (null rows). Maybe you want to ignore
> such lines when counting.
>
> MfG
> Karl-Heinz Zengerle
> ___________________________________________________
>  More than competence in Document Management
> ___________________________________________________
> SAW AG
> Waldmünchenerstr. 12
> 81549 München
> Tel.: ++49-89-68088368
> Fax: ++49-89-68088389
> www.sawag.com
>
> ___________________________________________________
>
> -----Ursprüngliche Nachricht-----
> Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> Gesendet: Montag, 1. Dezember 2003 11:25
> An: poi-user@jakarta.apache.org
> Betreff: Getting number of rows
>
> Hi,
>  In the eventmodel POI API, how can we get the total number of rows?
>  Is there an equivalent of a method in the usermodel api like
> getLastRowNum() of HSSFSheet?
> Thanks,
> Rommel.
>
> *********************************************************
> Disclaimer
>
> This message (including any attachments) contains
> confidential information intended for a specific
> individual and purpose, and is protected by law.
> If you are not the intended recipient, you should
> delete this message and are hereby notified that
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>
>

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com




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


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


Re: Getting number of rows

Posted by Rommel Sharma <ro...@mahindrabt.com>.
Hi Karl,
Thank You.
Actually I am validating an excel file where there could be thousands of
records also.
Some of the fields under some headers are mandatory. We have to detect the
missing fields and at the same time add each row in a vector.
So I want to detect when a new row starts, and I also want to detect a cell
with no value, so that I can put some default value for it in my vector.
I am not able to know when a new row starts which is important to create the
next Vector element.
Is there any class using which I can know, now the row  has started...
regards,
Rommel.

----- Original Message -----
From: "karl-heinz (SAW)" <ka...@sawag.com>
To: "'POI Users List'" <po...@jakarta.apache.org>
Sent: Monday, December 01, 2003 4:01 PM
Subject: AW: Getting number of rows

> Hi Rommel.
>
> You can retrieve the number of sheets and per sheet you can retrieve the
> number of rows.
>
> The function you'll have to code (summarize over all sheets the numbers
> of rows.
>
> Be careful:
> Also empty lines are contained (null rows). Maybe you want to ignore
> such lines when counting.
>
> MfG
> Karl-Heinz Zengerle
> ___________________________________________________
>  More than competence in Document Management
> ___________________________________________________
> SAW AG
> Waldmünchenerstr. 12
> 81549 München
> Tel.: ++49-89-68088368
> Fax: ++49-89-68088389
> www.sawag.com
>
> ___________________________________________________
>
> -----Ursprüngliche Nachricht-----
> Von: Rommel Sharma [mailto:rommels@mahindrabt.com]
> Gesendet: Montag, 1. Dezember 2003 11:25
> An: poi-user@jakarta.apache.org
> Betreff: Getting number of rows
>
> Hi,
>  In the eventmodel POI API, how can we get the total number of rows?
>  Is there an equivalent of a method in the usermodel api like
> getLastRowNum() of HSSFSheet?
> Thanks,
> Rommel.
>
> *********************************************************
> Disclaimer
>
> This message (including any attachments) contains
> confidential information intended for a specific
> individual and purpose, and is protected by law.
> If you are not the intended recipient, you should
> delete this message and are hereby notified that
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>
>

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com




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


AW: Getting number of rows

Posted by "karl-heinz (SAW)" <ka...@sawag.com>.
Hi Rommel.

You can retrieve the number of sheets and per sheet you can retrieve the
number of rows.

The function you'll have to code (summarize over all sheets the numbers
of rows.

Be careful:
Also empty lines are contained (null rows). Maybe you want to ignore
such lines when counting.

MfG 
Karl-Heinz Zengerle
___________________________________________________
 More than competence in Document Management 
___________________________________________________
SAW AG
Waldmünchenerstr. 12
81549 München
Tel.: ++49-89-68088368
Fax: ++49-89-68088389
www.sawag.com

___________________________________________________

-----Ursprüngliche Nachricht-----
Von: Rommel Sharma [mailto:rommels@mahindrabt.com] 
Gesendet: Montag, 1. Dezember 2003 11:25
An: poi-user@jakarta.apache.org
Betreff: Getting number of rows

Hi,
 In the eventmodel POI API, how can we get the total number of rows?
 Is there an equivalent of a method in the usermodel api like
getLastRowNum() of HSSFSheet?
Thanks,
Rommel.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com



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