Go Back   Forum - BIRT Exchange > Spreadsheets in Java Forums > Integrating e.Spreadsheet Engine and Deploying e.Spreadsheet Reports

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2009, 03:51 PM
Junior Member
 
Join Date: Jul 2008
Posts: 6
Default Can't save image in 2007 document format

Has anyone here been able to save a spreadsheet in 2007 document format with an image inserted? When I try it the image is not saved with the document.

I don't have any problems when saving to 97-2003 format.

sample code:
Document document = null;
BookModel bm = null;
FileInputStream inStream = null;
File file = null;
try {
document = new Document(null);
bm = BookModel.Factory.create(document.getBook());
bm.initWorkbook();
bm.getBook().setNumSheets(1);
bm.setSheet(0);

DrawingModel dm = bm.getDrawing();
inStream = new FileInputStream("C:\\xl\\image.jpg"); //<--replace with your own image

ShapeAnchor shapeAnchor = dm.createShapeAnchor(1, 1, 5, 10);
shapeAnchor.setPlacementStyle(ShapeAnchor.eMove);
Shape newShape = dm.addPicture(inStream, shapeAnchor);
newShape.setName("IMAGE.1");

//save the document to 2003 and 2007 format
file = new File("C:\\imageTest.xls");
document.fileSaveCopyAs(file, DocumentType.EXCEL_97_WORKBOOK, null);
file = new File("C:\\imageTest.xlsx");
document.fileSaveCopyAs(file, DocumentType.OPEN_XML_WORKBOOK, null);
} finally {
inStream.close();
document.release();
}
Reply With Quote
  #2 (permalink)  
Old 07-24-2009, 01:07 PM
Junior Member
 
Join Date: Oct 2007
Posts: 9
Default RE: Can't save image in 2007 document format

Charts are the only drawing objects, that the eSpreadsheet Engine currently supports, in the 2007 XLSX format.

You will have to use xls output.
Reply With Quote
Reply


Thread Tools
Display Modes




All times are GMT -7. The time now is 05:08 AM.
Powered by vBulletin Copyright © 2000-2010 Jelsoft Enterprises Limited.


Content Relevant URLs by vBSEO 3.1.0