You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Geoff Wright <ge...@wrightville.org> on 2014/08/04 17:10:01 UTC
XLSFPictureData and link to file
When adding a picture to a PowerPoint presentation, you can embed the file or link to it. The embedded filename can be accessed using:
XSLFPictureData data = ((XSLFPictureShape) shape).getPictureData();
System.out.println(data.getFileName());
output:
org.apache.poi.xslf.usermodel.XSLFPictureShape@654df764
image7.png
However, when the picture is not embedded but inserted only as a "link to file", there is no data available and the above code produces a null pointer exception.
Is there a way to access the name of the linked picture file ? Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: XLSFPictureData and link to file
Posted by Geoff Wright <ge...@wrightville.org>.
Thanks Nick — your fix (r1615812) works perfectly.
Geoff
On Aug 4, 2014, at 5:36 PM, Nick Burch <ap...@gagravarr.org> wrote:
> On Mon, 4 Aug 2014, Geoff Wright wrote:
>> This is my first bug report so please let me know if there is something I could have done better.
>
> Looks good, thanks! Now to work out why it's null....
>
> If you have a minute, do please read through the Contribution Guidelines, and let us know if there's anything in there that's confusing / hard to follow / should be made more obvious / etc. We want to make it easy for new people to get involved! http://poi.apache.org/guidelines.html
>
> Thanks
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: XLSFPictureData and link to file
Posted by Nick Burch <ap...@gagravarr.org>.
On Mon, 4 Aug 2014, Geoff Wright wrote:
> This is my first bug report so please let me know if there is something
> I could have done better.
Looks good, thanks! Now to work out why it's null....
If you have a minute, do please read through the Contribution Guidelines,
and let us know if there's anything in there that's confusing / hard to
follow / should be made more obvious / etc. We want to make it easy for
new people to get involved! http://poi.apache.org/guidelines.html
Thanks
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: XLSFPictureData and link to file
Posted by Geoff Wright <ge...@wrightville.org>.
Thanks Nick. Bug report has been submitted as Bug 56812.
This is my first bug report so please let me know if there is something I could have done better.
Cheers.
On Aug 4, 2014, at 11:15 AM, Nick Burch <ap...@gagravarr.org> wrote:
> On Mon, 4 Aug 2014, Geoff Wright wrote:
>> XSLFPictureData data = ((XSLFPictureShape) shape).getPictureData();
>> System.out.println(data.getFileName());
>>
>> However, when the picture is not embedded but inserted only as a "link to file", there is no data available and the above code produces a null pointer exception.
>
> Any chance you could open a new bug in bugzilla, upload a very small sample file that shows the problem, the stacktrace, and a trivial junit unit test based on your code above?
>
> Someone'll need to update the code to check if it's an external link or not, and fetch it the other way if so. The above should help make that quick to check how.
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
Re: XLSFPictureData and link to file
Posted by Nick Burch <ap...@gagravarr.org>.
On Mon, 4 Aug 2014, Geoff Wright wrote:
> XSLFPictureData data = ((XSLFPictureShape) shape).getPictureData();
> System.out.println(data.getFileName());
>
> However, when the picture is not embedded but inserted only as a "link
> to file", there is no data available and the above code produces a null
> pointer exception.
Any chance you could open a new bug in bugzilla, upload a very small
sample file that shows the problem, the stacktrace, and a trivial junit
unit test based on your code above?
Someone'll need to update the code to check if it's an external link or
not, and fetch it the other way if so. The above should help make that
quick to check how.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org