• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Java Struts: Excel Report Generation Using Java

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

I have requirement of generating an excel report based on the data available in the database. For now we are using a String Builder and populating a html file where all the data is stored in tabular format and will be flushed into a "application/xls;charset=UTF-8" format for excel file genration.

The problem we are facing is that if we use a pure number to generate the excel report, then in the report if the number of digits is more than 20 then the excel is converting it to a exponential values.

Is there any other way we can generate a excel report without having to resort to creating a HTML file then convert this html file through string into an Excel file.

Here is a portion of the code




Regards
Dilip H P
Excel-Report.png
[Thumbnail for Excel-Report.png]
 
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dilip,

You can use the Apache POI https://poi.apache.org/ library. The column formatting can be applied to address the issue which you are talking about.

Thanks
Srikkanth
 
Dilip H Pashupathi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srikkanth,

Thanks for the reply. But the problem is I am not sure we can add more new jars to project as this current project is scheduled for production release in another week. Since it requires much testing and R&D work we need to take permission from managers to do the changes. But any how thank you.

Regards
Dilip H P
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dilip H Pashupathi wrote:
The problem we are facing is that if we use a pure number to generate the excel report, then in the report if the number of digits is more than 20 then the excel is converting it to a exponential values.



Excel is limited to 15 significant digits for numeric values. Are these values where an approximation will suffice, or are these part numbers or SKU's, where they have to be exact?
Since this isn't a Struts issue, I'm going to move this to a more appropriate forum.
 
What are your superhero powers? Go ahead and try them on this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic