• Post Reply Bookmark Topic Watch Topic
  • New Topic

saving excel file into an image  RSS feed

 
vishnu hiranamayee
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I checked Save As option in Microsoft Excel and they don�t have facility to save an image.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • 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 ]
 
Paul Clapham
Sheriff
Posts: 22708
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
Er. Ashish Aggarwal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!