poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Princess <hepzib...@googlemail.com>
Subject logo along with a Chart in Excel (HSSF)
Date Thu, 18 Dec 2008 18:32:41 GMT
int pictureIndex = wb.addPicture(data, HSSFPicture.PICTURE_TYPE_PNG);

            HSSFSheet sheet = wb.getSheetAt(1);
            HSSFPatriarch patriarch = sheet.createDrawingPatriarch();

            //all pictures use the same picture index, thus sharing the same
picture data
            HSSFPicture pic1 =  patriarch.createPicture(new
HSSFClientAnchor(0, 0, 10, 10,
                          (short)10, 0, (short)13, 3), pictureIndex);

The above code works when i have a worksheet with no graph/chart ..

But my requirement is a Excel file which will have data in sheet1 and a
Chart for the Data in Sheet2 along with a logo.

Now When using the aboce code snippet  i get a error message saying that the
Data would be lost and on opening the file
Sheet2  is totally erratic..Sheet1 is intact

I am using a Template for this

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message