poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53568] Pictures in XSSF have NULL anchors
Date Wed, 03 Oct 2012 13:08:41 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53568

--- Comment #2 from OnionHead <onionhead0708@gmail.com> ---
Created attachment 29440
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29440&action=edit
Temporary fix


As I've also encounter the same problem, I've tried to fix and seems work in my
case. 

Attached please find the temporary fix for the mentioned problem.

Please replace the XSSFDrawing.class and XSSFPicture.class in the
poi-ooxml-3.8-20120326.jar

Followings are the changes I've made (Code changes are based on version:
poi-ooxml-3.8-20120326.jar)

In folder src\ooxml\java\org\apache\poi\xssf\usermodel:

File: XSSFPicture.java
Add new Constructor: protected XSSFPicture(final XSSFDrawing drawing, final
CTPicture ctPicture, final CTTwoCellAnchor anchor)
Description: assign also the anchor to the protected class variable

Update function: public XSSFPictureData getPictureData()
Changes: Before looping to find the part in the drawing.relations collection,
use getDrawing().getRelationById(blipId) to find the docPart. 
Doing this because seems sometimes the part.getPackageRelationship().getId()
return a wrong relation Id.

File: XSSFDrawing.java
Update function: public List<XSSFShape>  getShapes()
Changes: If the obj is CTPicture and the parent XML object is CTTwoCellAnchor,
call add a new XSSFPicture using the anchor info

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


Mime
View raw message