• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

saving excel file into an image

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

The problem is I want a solution to convert excel file into an image, i.e., an application which should read an excel file (some range of cells) and save it as an image (jpeg, bmp).
I am trying by using POI but it is not capturing the data in the image.


Regards
vishnu
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I checked Save As option in Microsoft Excel and they don�t have facility to save an image.
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you've already got an API to extract data from Excel files, I'm assuming you've managed to get objects representing the spreadsheet, and the various cells and data it contains?

I suppose the next job is to build a rendering engine which lays all that data out onto a virtual "canvas", using java.awt and java.awt.geom to do some of the hard work, and then a converter which takes all the pixel data on that canvas and puts it in a java.awt.BufferedImage. You can then use the Image I/O API to export this into an image file.

So if you have both the importers for Excel files and exporters for images (exporters for common formats are supplied with the Image I/O API), then all you need is an engine which does the geometry and layout, then writes the data to the Graphics2D obtained from the BufferedImage's createGraphics() method. You need to be familiar with the elementary AWT graphics classes and have some familiarity with geometry, but it's certainly doable.

If you want a rough sketch of an approach, feel free to ask.
[ March 17, 2006: Message edited by: Charles Lyons ]
 
Marshal
Posts: 27451
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
However if you were hoping for some Java code which duplicates the way that Excel lays out a spreadsheet when it displays it on your computer monitor, I am fairly certain that code does not exist. But as Charles suggests, you could certainly try it yourself.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To do this you can use Aspose lib. Aspose cells gives a wide range of api to perform actions on excel sheet. Here is a link where you found how to export excel sheet as png/jpeg images and also how to get the images of excel componnt too.

http://iandjava.blogspot.in/2013/07/convert-excel-document-to-images.html
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic