File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in reading an embedded image from excel sheet using JXL

 
Sebi Peter
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

I was facing one problem in reading an image and putting into the database as a blob from excel sheet.If I copy the image and place it on the cell then the code I have written down works fine..
But now the problem is the image is embedded in the excel sheet so I�m not able to read this When I�m reading this some junk value is read into the database.So if any body has some suggestions just help me out..

I�m writing the code which I have used.. and I�m not able to attach the the excel sheetBut just to let u know it uses =EMBED("MSPhotoEd.3","") in the formula bar
the code written down does not work fine for images which are embedded

I�m using jxl

import jxl.Cell;
import jxl.Image;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

// reading the drawing

Image img = sheet.getDrawing(0);

// putting it in byte array
byte[] imageData = img.getImageData();

// inserting into database blob object

prepareStatement.setBytes(1, imageData);

if any body can come with some suggestions about how can i do it.It will be quite helpful
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic