poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Stranathan <w...@thestranathans.com>
Subject Re: poi hssf translate column numbers to letters
Date Fri, 21 Jan 2005 17:01:19 GMT
I figured so too, but I looked and alas found nothing - so I cobbled 
one together.  Prolly not 100% accurate, either.

w

On Fri, 21 Jan 2005 21:37:50 +0530
  Avik Sengupta <avik.sengupta@itellix.com> wrote:
>There should be such a function in some util package in POI.. cant
>remember where. 
>
>On Fri, 2005-01-21 at 10:04 -0600, David.Ventimiglia@wellsfargo.com
>wrote:
>> Thanks!
>> 
>> -----Original Message-----
>> From: Will Stranathan [mailto:will@thestranathans.com]
>> Sent: Friday, January 21, 2005 6:26 AM
>> To: POI Users List
>> Subject: Re: poi hssf translate column numbers to letters
>> 
>> 
>> Here's a BSH function I use.  Feel free to translate to proper Java:
>> 
>> getColName(short num) {
>> 	v = new Vector();
>> 	String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
>> 	for (i = 0; i < alphabet.length(); i++) {
>> 		v.add(alphabet.charAt(i));
>> 	}
>> 	for (i = 0; i < alphabet.length(); i++) {
>> 		for (j = 0; j < alphabet.length(); j++) {
>> 			v.add(alphabet.charAt(i) + alphabet.charAt(j));
>> 		}
>> 	}
>> 	return(v.elementAt(num));
>> }
>> 
>> 
>> 
>> On Thu, 20 Jan 2005 15:40:35 -0600
>>   <David.Ventimiglia@wellsfargo.com> wrote:
>> >Ok, no problem.  I was just wondering if there was already a handy 
>> >function somewhere in the object model to do it automagically. 
>> > Thanks!
>> >
>> >
>> >-----Original Message-----
>> >From: Chris Cheshire [mailto:ccheshire@bigredwire.com]
>> >Sent: Thursday, January 20, 2005 1:31 PM
>> >To: POI Users List
>> >Subject: Re: poi hssf translate column numbers to letters
>> >
>> >
>> >The columns are the numerical position of the letter in the 
>>alphabet 
>> >minus 1 (for the 0 indexing of the columns and rows into arrays), 
>>for 
>> >the single letter codes, then adding 26 for each iteration of the 
>> >double 
>> >lettering.
>> >
>> >I have a sheet handy when I am writing code for formulae that has 
>>the 
>> >column numbers and letters to make it easier. Just
>> >
>> >0  A
>> >1  B
>> >2  C
>> >3  D
>> >....
>> >26 AA
>> >....
>> >52 BA
>> >....
>> >78 CA
>> >....
>> >etc.
>> >
>> >
>> >HTH
>> >
>> >Chris
>> >David.Ventimiglia@wellsfargo.com wrote:
>> >> Hello,
>> >> 
>> >> First, thank you thank you thank you for creating POI.  It really 
>>is 
>> >>terrific.
>> >> 
>> >> However, I have a question.  How do I get the Excel column 
>>"letter" 
>> >>for a column?  I think I need it to set formulas (e.g. 
>>"SUM(A2:A3)"), 
>> >>but HSSF seems to assume columns are created and referenced 
>> >>numberically.  How do I get from POI/HSSF the fact that column #25 
>>is 
>> >>the same as column "AA" (I think...I might be off by one, but you 
>>get 
>> >>the picture)?  Thanks!!
>> >> 
>> >> Regards,
>> >> David A. Ventimiglia
>> >> 
>> >> 
>>---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> >> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> >> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>> >> 
>> >> 
>> >> 
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> >Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> >The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>> >
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> >Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> >The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>> >
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>> 
>-- 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message