https://issues.apache.org/bugzilla/show_bug.cgi?id=53568

--- Comment #4 from OnionHead <[email protected]> ---
Created attachment 29447
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29447&action=edit
Example for wrong part.getPackageRelationship().getId()

Hi, Yegor,

Thanks for applying the fix.

Attached please find the testing case (sample-image.xlsx) that I found wrong on
the part.getPackageRelationship().getId() 

I use my testing class TestReadExcelImage to manually check the problem.

Please check the worksheet: IMAGE4
There are 3 pictures inside which reference to 2 images.
When getting the pictureData of the first picture using
picture.getPictureData(), a null value is return:

>>output: picture.getPictureData() is null, try finding in relations

Then I loop the picture.getDrawing().getRelations() to output and check the
part.getPackageRelationship().getId():

>>output: part.getPackageRelationship().getId()=rId2
>>output: part.getPackageRelationship().getId()=rId3

I then extract the excel file and check the XML file:
\xl\drawings\_rels\drawing3.xml.rels

The id of relationship are: rId2, rId1 which doesn't match with the one using
part.getPackageRelationship().getId()

So, I think that the part.getPackageRelationship().getId() must be wrong.

I then use the picture.getDrawing().getRelationById(embedId) to get the
corresponding picutureData. This time, the information returned is correct:

>>output: pictureName=/xl/media/image2.jpeg
>>output: Fm position = [20, 3]
>>output: To position = [22, 3]

Afterward, I get the pictureData of the 2nd and 3rd picture using the
picture.getPictureData(). Again, the information returned is incorrect:

>>output: pictureName=/xl/media/image2.jpeg
>>output: Fm position = [2, 4]
>>output: To position = [12, 7]
>>output: pictureName=/xl/media/image2.jpeg
>>output: Fm position = [15, 5]
>>output: To position = [25, 8]

The name of the image should be image3.jpg instead of image2.jpeg

After I applied the fix to the picture.getPictureData(), there seems to be no
problem then. 
I still don't know why the part.getPackageRelationship().getId() return a wrong
value but fixing picture.getPictureData() using the
getDrawing().getRelationById(blipId) seems to be a quick fix.

Hope this help. Thanks.

-- 
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]

Reply via email to