You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Andreas Beeker (Jira)" <ji...@apache.org> on 2021/06/23 20:49:00 UTC

[jira] [Resolved] (XMLBEANS-475) Adding image using XSSF with previous images corrupts the entire file

     [ https://issues.apache.org/jira/browse/XMLBEANS-475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Beeker resolved XMLBEANS-475.
-------------------------------------
    Fix Version/s: Version 5.0.1
       Resolution: Invalid

There's no method ((XSSFDrawing) patriarch).createLinkedPicture - therefore I can't reproduce the error. If you can reproduce it with a current POI version, please open an issue in our POI bugzilla - with all necessary code parts.

> Adding image using XSSF with previous images corrupts the entire file
> ---------------------------------------------------------------------
>
>                 Key: XMLBEANS-475
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-475
>             Project: XMLBeans
>          Issue Type: Bug
>    Affects Versions:  Version 2.3
>         Environment: Windows 7, eclipse, java 1.6
>            Reporter: Michael Benoit
>            Priority: Major
>             Fix For: Version 5.0.1
>
>         Attachments: OnePicture.xlsx
>
>
> When I try to add images to an xlsx file that already contains images, the image is appended as a fragment at the end of the file which causes Microsoft Office to say the file is corrupted and gives the option of trying to recover.
> Workbook workbook = new XSSFWorkbook(doc);
> Sheet sheet;
> if(workbook.getNumberOfSheets() > 0){
> 	sheet = workbook.getSheetAt(0);
> } else {
> 	sheet = workbook.createSheet();
> }
> Drawing patriarch = sheet.createDrawingPatriarch();
> ClientAnchor anchor = workbook.getCreationHelper().createClientAnchor();
> anchor.setCol1(10);
> anchor.setRow1(1);
> anchor.setDx1(100);
> anchor.setDy1(190);
> ((XSSFDrawing) patriarch).createLinkedPicture(anchor,"a location");
> workbook.write(outDoc);
> doc.close();
> outDoc.close();



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org