You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by th...@gmail.com on 2012/09/06 23:34:47 UTC

Retrieving column header.

How can I get the header of a column from an excel spreadsheet. Eg.. If I have a column header
 Column1 
     1    
     2
     3
I want to be able to retrieve the column header ie Column1. 

Best Regards,
Mckeane Thomas.
Sent from my BlackBerry® device from Digicel

Re: Retrieving column header.

Posted by Lo...@log-net.com.
As Nick says, just grab the first row - there is nothing special about it. 
 

I almost sounds like you are thinking about a DBase file - they have 
specific column headers since they are formatted more like a DB table than 
a spreadsheet.

If you are asking about getting the column header (i.e. A, B, C, ...), 
then you would want to iterate through your valid columns and do:

CellReference.convertNumToColString(cell.getColumnIndex())

-Lou

Nick Burch <ap...@gagravarr.org> wrote on 2012-09-06 06:11:34 PM:

> Nick Burch <ap...@gagravarr.org> 
> 2012-09-06 06:11 PM
> 
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> To
> 
> thomas.mckeane22@gmail.com, 
> 
> cc
> 
> POI Users List <us...@poi.apache.org>
> 
> Subject
> 
> Re: Retrieving column header.
> 
> On Thu, 6 Sep 2012, thomas.mckeane22@gmail.com wrote:
> > How can I get the header of a column from an excel spreadsheet. 
> Eg.. If I have a column header
> > Column1
> >     1
> >     2
> >     3
> > I want to be able to retrieve the column header ie Column1.
> 
> Grab the first row, and read the cells from that?
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 

Re: Retrieving column header.

Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 6 Sep 2012, thomas.mckeane22@gmail.com wrote:
> How can I get the header of a column from an excel spreadsheet. Eg.. If I have a column header
> Column1
>     1
>     2
>     3
> I want to be able to retrieve the column header ie Column1.

Grab the first row, and read the cells from that?

Nick

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