https://issues.apache.org/bugzilla/show_bug.cgi?id=55705
Bug ID: 55705
Summary: Inserting picture into sheet with chart corrupts
workbook
Product: POI
Version: 3.10-dev
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
Created attachment 30971
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30971&action=edit
Test file
When a picture is inserted into sheet that has a chart, resulting file is
corrupted and causes Excel crash in my case.
Code used:
Workbook wb = WorkbookFactory.create(new File("Test_chart.xls"));
InputStream is = new FileInputStream("project-logo.jpg");
byte[] bytes = IOUtils.toByteArray(is);
int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG);
is.close();
CreationHelper helper = wb.getCreationHelper();
Sheet sheet = wb.getSheetAt(0);
Drawing drawing = sheet.createDrawingPatriarch();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setCol1(10);
anchor.setRow1(2);
anchor.setCol2(13);
anchor.setRow2(8);
drawing.createPicture(anchor, pictureIdx);
String file = "Chart_and_picture.xls";
FileOutputStream fileOut = new FileOutputStream(file);
wb.write(fileOut);
fileOut.close();
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]