• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

POI issue with writing data to cell in excel sheet

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am writing data to excel sheet using POI

Now when i am trying to write the BigDecimal value to a cell using following code


where

partBean.getBestBuyFactor()

is a BigDecimal value 1 but it is getting written to the cell as 1.000
because POI is treating it as a

text

and not as

number



so i tried setting the cellType as

cell.setCellType(Cell.CELL_TYPE_NUMERIC);

but still POI is treating it as a string.

So can any one please help me why this is happening and how to resolve it?

I am attaching the screenshot of the excel sheet data.

Thanks in advance
Prashant
POI-problem.JPG
[Thumbnail for POI-problem.JPG]
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic