Forums > Help! > Please Help, problem with cellType

Login/Join to Participate

1 post

Hello Friends,
I am new to Poi world. I am facing one problem.

My requirement is that I want a excel sheet in which format type of cells of first column should always be a Text. For other columns the format type may be general or numeric.
Why I require first columns format type as text, because when ever user is entering long number in excel it automatically converts that to scientific notation. Like if I entered value 123456789012 in cell it automatically becomes 1.23457E+11. I was programmatically creating Excel by using Poi.

I dont want such behavior at least in first column of excel sheet. To avoid this, what I have done is instead of dynamically generating excel sheet I am keeping the predefined excel file and made its first columns property as a Text. This approach is working fine for all cells in the first column except in which I am adding some value dynamically through program. Its type automatically becomes General from Text. But the cells in the first column which are empty are still showing me the property type as Text.
To overcome this I have used following code,

HSSFCellStyle cellStyle = cell.getCellStyle();

And for other cells in other column I am again setting type as cell.setCellType(CELL_TYPE_NUMERIC);

But what I observed is that now all cells type becomes Text. If I dont use setDataFormat for first column and if only use setCellType, its type is not changing to text it remains to General only. I am using 2.5 version of Poi.

Can you please help me out from this problem?

Thanks and Regards,
Sachin Dare.

577 posts
Location: Oregon, USA

3 bt weave?

No.. wait, I know the answer to this..



You may want to look into the site a little more before posting. You may want to research who you are asking before you ask. You also may want to go back to your search engine and continue your search.

Good luck, you're in the wrong place. This poi is at least at version aught'6.

Definition of poi- A Hawaiian food made from the tuber of the taro that is cooked, pounded to a paste, and fermented.

Ahnold discussing poi - "It is naht a toober!"

[Nx?]BRONZE Member
Carpal \'Tunnel
3,749 posts
Location: Europe,Scotland,Both

LOL ubblol

thats the trouble with the internet, they let anyone on here (unless your chineeze)

This is a post by tom, all spelling is deleberate
-><- Kallisti

328 posts
Location: uk

You might want to try Jakarta POI 2.5.1, just a thought, or perhaps poi-3.0-alpha1.


Ange_GSCGOLD Member
HOP's glowstick ambassador!!
128 posts
Location: Bay Area, California, USA

???? huh? umm

maybe if you lit the annoying column cells on fire?

missegyptology: "I just remember beingall off balance and unicycling really fast down to campus and the arabic was all blurred on the page"

^When Linz pulls an all nighter before Arabic class^

flash fireBRONZE Member
Sporadically Prodigal
2,758 posts
Location: Sydney, NSW, Australia

Different sort of poi. See our home page, and you'll soon realise that.

HoP Posting Guidelines
Is it the Truth?
Is it Fair to all concerned?
Will it build Goodwill and Better Friendships?
Will it be Beneficial to all concerned?
If you can answer YES to these 4 questions then you may post a reply.

HOP Newsletter
Sign up to get the latest on sales, new releases and more...