| Author |
saving excel file into an image
|
vishnu hiranamayee
Greenhorn
Joined: Feb 23, 2006
Posts: 17
|
|
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
Joined: Sep 16, 2004
Posts: 3636
|
|
|
Even I checked Save As option in Microsoft Excel and they don�t have facility to save an image.
|
My blood is tested +ve for Java.
|
 |
Charles Lyons
Author
Ranch Hand
Joined: Mar 27, 2003
Posts: 836
|
|
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 ]
|
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
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.
|
 |
 |
|
|
subject: saving excel file into an image
|
|
|