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

Reply via email to