You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Ramon F Herrera <ra...@patriot.net> on 2010/04/20 21:56:24 UTC

How to convert zero-based cell coordinates to alphanumeric?

My application contains a typical formula:

     cell.cellValue =  "SUM(K16:K18)";
     cell.dataFormat = FormatType.CELL_TYPE_FORMULA;
     cell.contentFrmat = styles.get("2-decimal_number");

Let's say that the locations K16-K18 are not known until run time. Is 
there some facility to convert 0-based to alphanumeric?

It is easy enough to implement the above. I just don't want to reinvent 
the wheel.

TIA,

-Ramon




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


Re: How to convert zero-based cell coordinates to alphanumeric?

Posted by Ramon F Herrera <ra...@patriot.net>.
On 4/20/2010 3:35 PM, Steve Wolke wrote:
> I think you can use the CellReference class and the formatAsString
> method.
>
>
> http://poi.apache.org/apidocs/org/apache/poi/ss/util/CellReference.html#
> formatAsString()
>

Works like a charm...

Thx,

-RFH

---------------------
CellReference cellRef;
cellRef = new CellReference(15, 10);
String alphaNumericBegin = cellRef.formatAsString();
cellRef = new CellReference(15 + nofTubes - 1, 10);
String alphaNumericEnd = cellRef.formatAsString();
cell.cellValue = "SUM("+alphaNumericBegin+":"+alphaNumericEnd+")";


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


RE: How to convert zero-based cell coordinates to alphanumeric?

Posted by Steve Wolke <Sw...@roughbros.com>.
I think you can use the CellReference class and the formatAsString
method.


http://poi.apache.org/apidocs/org/apache/poi/ss/util/CellReference.html#
formatAsString()




> -----Original Message-----
> From: Ramon F Herrera [mailto:ramon@patriot.net]
> Sent: Tuesday, April 20, 2010 3:56 PM
> To: user@poi.apache.org
> Subject: How to convert zero-based cell coordinates to alphanumeric?
> 
> 
> My application contains a typical formula:
> 
>      cell.cellValue =  "SUM(K16:K18)";
>      cell.dataFormat = FormatType.CELL_TYPE_FORMULA;
>      cell.contentFrmat = styles.get("2-decimal_number");
> 
> Let's say that the locations K16-K18 are not known until run time. Is
> there some facility to convert 0-based to alphanumeric?
> 
> It is easy enough to implement the above. I just don't want to
reinvent
> the wheel.
> 
> TIA,
> 
> -Ramon
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org


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