You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Márcio Albuquerque <ma...@logann.com.br> on 2012/10/19 01:19:35 UTC
Is it possible to create a power point hyperlink from one slide to another?
Hi!
I've seen in the hslf examples that it is possible to create a power point
hyperlink to an URL using POI.
I am wondering if it is also possible to create a hyperlink that points to
another slide.
Is it?
Thanks in advance.
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Márcio Albuquerque <ma...@logann.com.br>.
Any help?
Looks like hyperlinks to other slides are not implemented yet. I tried to
change the method setHyperlink of the class SimpleShape in the POI source
code:
case InteractiveInfoAtom.LINK_SlideNumber:
infoAtom.setAction(InteractiveInfoAtom.ACTION_HYPERLINK);
infoAtom.setJump(InteractiveInfoAtom.JUMP_NONE);
infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_SlideNumber);
But after this change it still didn't work. Any idea if I should change
something else?
Thanks!
2012/10/19 Márcio Albuquerque <ma...@logann.com.br>
> Hi Yegor,
> Thank you for the reply.
> I use poi-3.8-20120326.jar. I copied your code but no hyperlink is
> generated when I set type = InteractiveInfoAtom.LINK_SlideNumber.
> Do I have to get the last build from trunk?
> Thanks!
>
> 2012/10/19 Yegor Kozlov <ye...@dinom.ru>
>
>> SlideShow ppt = new SlideShow();
>>
>> Slide slideA = ppt.createSlide();
>> Slide slideB = ppt.createSlide();
>>
>> TextBox textBox = new TextBox();
>> String text = "Go to Slide #2";
>> textBox.setText(text);
>> textBox.setAnchor(new Rectangle(100, 200, 200, 50));
>>
>> String href = slideB._getSheetNumber() + ",1,Link";
>> Hyperlink hyperlink = new Hyperlink();
>> hyperlink.setAddress(href);
>> hyperlink.setTitle(textBox.getText());
>> hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
>> int linkId = ppt.addHyperlink(hyperlink);
>>
>> textBox.setHyperlink(hyperlink);
>> slideA.addShape(textBox);
>>
>> FileOutputStream out = new FileOutputStream("hyperlink.ppt");
>> ppt.write(out);
>> out.close();
>>
>>
>> On Fri, Oct 19, 2012 at 3:19 AM, Márcio Albuquerque
>> <ma...@logann.com.br> wrote:
>> > Hi!
>> > I've seen in the hslf examples that it is possible to create a power
>> point
>> > hyperlink to an URL using POI.
>> > I am wondering if it is also possible to create a hyperlink that points
>> to
>> > another slide.
>> > Is it?
>> > Thanks in advance.
>> >
>> > --
>> > Marcio Brandão Albuquerque
>> > Analista de Sistemas
>> > LOGANN Soluções Especiais
>> > (31) 2512-0965
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>
>
> --
> Marcio Brandão Albuquerque
> Analista de Sistemas
> LOGANN Soluções Especiais
> (31) 2512-0965
>
>
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Márcio Albuquerque <ma...@logann.com.br>.
Thank you so much! I owe you a beer.
2012/10/24 Yegor Kozlov <ye...@dinom.ru>
> It appears that it is indeed the default behavior: no matter what you
> set, the link always goes to the next slide.
>
> I improved HSLF to support hyperlinks to slides, the fix committed in
> r1401642
>
> With this fix you don't have to construct the href yourself. There is
> a overridden Hyperlink.setAddress(Slide slide) which takes the target
> slide and construct the href internally.
>
> You can follow the example :
>
>
> https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hslf/examples/CreateHyperlink.java
>
> Twy the latest buuld from trunk. Links to nightly builds are on
> http://poi.apache.org/
>
> Yegor
>
> On Tue, Oct 23, 2012 at 8:43 PM, Márcio Albuquerque
> <ma...@logann.com.br> wrote:
> > I modified your code to go to slide 3 instead of 2 but it is not working,
> > it still goes to slide 2. I think it's just the default behavior of going
> > to the next slide when I click, no link is being generated. Here's my
> code:
> >
> > SlideShow ppt = new SlideShow();
> >
> > Slide slideA = ppt.createSlide();
> > Slide slideB = ppt.createSlide();
> > Slide slideC = ppt.createSlide();
> >
> > slideA.addTitle().setText("Slide 1");
> > slideB.addTitle().setText("Slide 2");
> > slideC.addTitle().setText("Slide 3");
> >
> > TextBox textBox = new TextBox();
> > String text = "Go to Slide #3";
> > textBox.setText(text);
> > textBox.setAnchor(new Rectangle(100, 200, 200, 50));
> >
> > String href = slideC._getSheetNumber() + ",1,Link";
> > Hyperlink hyperlink = new Hyperlink();
> > hyperlink.setAddress(href);
> > hyperlink.setTitle(textBox.getText());
> > hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
> > int linkId = ppt.addHyperlink(hyperlink);
> >
> > textBox.setHyperlink(hyperlink);
> > slideA.addShape(textBox);
> >
> > FileOutputStream out = new FileOutputStream("hyperlink.ppt");
> > ppt.write(out);
> > out.close();
> >
> > 2012/10/23 Yegor Kozlov <ye...@dinom.ru>
> >
> >> > How would you change your code to make it go to slide #3 instead of 2?
> >>
> >> the hyperlink address includes sheet number, e.g.
> slideB._getSheetNumber()
> >> :
> >>
> >> String href = slideB._getSheetNumber() + ",1,Link";
> >>
> >>
> >> > What
> >> > does the number 1 in the href mean?
> >>
> >> I don't know. the href formula was derived empirically by reverse
> >> engineering. This is the pattern used by MS PowerPoint.
> >>
> >> Yegor
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
> >
> >
> > --
> > Marcio Brandão Albuquerque
> > Analista de Sistemas
> > LOGANN Soluções Especiais
> > (31) 2512-0965
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Yegor Kozlov <ye...@dinom.ru>.
It appears that it is indeed the default behavior: no matter what you
set, the link always goes to the next slide.
I improved HSLF to support hyperlinks to slides, the fix committed in r1401642
With this fix you don't have to construct the href yourself. There is
a overridden Hyperlink.setAddress(Slide slide) which takes the target
slide and construct the href internally.
You can follow the example :
https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hslf/examples/CreateHyperlink.java
Twy the latest buuld from trunk. Links to nightly builds are on
http://poi.apache.org/
Yegor
On Tue, Oct 23, 2012 at 8:43 PM, Márcio Albuquerque
<ma...@logann.com.br> wrote:
> I modified your code to go to slide 3 instead of 2 but it is not working,
> it still goes to slide 2. I think it's just the default behavior of going
> to the next slide when I click, no link is being generated. Here's my code:
>
> SlideShow ppt = new SlideShow();
>
> Slide slideA = ppt.createSlide();
> Slide slideB = ppt.createSlide();
> Slide slideC = ppt.createSlide();
>
> slideA.addTitle().setText("Slide 1");
> slideB.addTitle().setText("Slide 2");
> slideC.addTitle().setText("Slide 3");
>
> TextBox textBox = new TextBox();
> String text = "Go to Slide #3";
> textBox.setText(text);
> textBox.setAnchor(new Rectangle(100, 200, 200, 50));
>
> String href = slideC._getSheetNumber() + ",1,Link";
> Hyperlink hyperlink = new Hyperlink();
> hyperlink.setAddress(href);
> hyperlink.setTitle(textBox.getText());
> hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
> int linkId = ppt.addHyperlink(hyperlink);
>
> textBox.setHyperlink(hyperlink);
> slideA.addShape(textBox);
>
> FileOutputStream out = new FileOutputStream("hyperlink.ppt");
> ppt.write(out);
> out.close();
>
> 2012/10/23 Yegor Kozlov <ye...@dinom.ru>
>
>> > How would you change your code to make it go to slide #3 instead of 2?
>>
>> the hyperlink address includes sheet number, e.g. slideB._getSheetNumber()
>> :
>>
>> String href = slideB._getSheetNumber() + ",1,Link";
>>
>>
>> > What
>> > does the number 1 in the href mean?
>>
>> I don't know. the href formula was derived empirically by reverse
>> engineering. This is the pattern used by MS PowerPoint.
>>
>> Yegor
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>
>
> --
> Marcio Brandão Albuquerque
> Analista de Sistemas
> LOGANN Soluções Especiais
> (31) 2512-0965
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Márcio Albuquerque <ma...@logann.com.br>.
I modified your code to go to slide 3 instead of 2 but it is not working,
it still goes to slide 2. I think it's just the default behavior of going
to the next slide when I click, no link is being generated. Here's my code:
SlideShow ppt = new SlideShow();
Slide slideA = ppt.createSlide();
Slide slideB = ppt.createSlide();
Slide slideC = ppt.createSlide();
slideA.addTitle().setText("Slide 1");
slideB.addTitle().setText("Slide 2");
slideC.addTitle().setText("Slide 3");
TextBox textBox = new TextBox();
String text = "Go to Slide #3";
textBox.setText(text);
textBox.setAnchor(new Rectangle(100, 200, 200, 50));
String href = slideC._getSheetNumber() + ",1,Link";
Hyperlink hyperlink = new Hyperlink();
hyperlink.setAddress(href);
hyperlink.setTitle(textBox.getText());
hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
int linkId = ppt.addHyperlink(hyperlink);
textBox.setHyperlink(hyperlink);
slideA.addShape(textBox);
FileOutputStream out = new FileOutputStream("hyperlink.ppt");
ppt.write(out);
out.close();
2012/10/23 Yegor Kozlov <ye...@dinom.ru>
> > How would you change your code to make it go to slide #3 instead of 2?
>
> the hyperlink address includes sheet number, e.g. slideB._getSheetNumber()
> :
>
> String href = slideB._getSheetNumber() + ",1,Link";
>
>
> > What
> > does the number 1 in the href mean?
>
> I don't know. the href formula was derived empirically by reverse
> engineering. This is the pattern used by MS PowerPoint.
>
> Yegor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Yegor Kozlov <ye...@dinom.ru>.
> How would you change your code to make it go to slide #3 instead of 2?
the hyperlink address includes sheet number, e.g. slideB._getSheetNumber() :
String href = slideB._getSheetNumber() + ",1,Link";
> What
> does the number 1 in the href mean?
I don't know. the href formula was derived empirically by reverse
engineering. This is the pattern used by MS PowerPoint.
Yegor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Márcio Albuquerque <ma...@logann.com.br>.
Hi!
I tried the latest build from trunk and it looks like it works, but I'm not
sure, because the default behavior when you click a slide is to go to the
next slide, even when there is no link.
How would you change your code to make it go to slide #3 instead of 2? What
does the number 1 in the href mean?
Thanks a lot!
2012/10/23 Yegor Kozlov <ye...@dinom.ru>
> Please try with the latest build from trunk. I've just re-checked my
> code and it works OK for me. I'm using MS Office 2010.
>
> Yegor
>
> On Fri, Oct 19, 2012 at 10:00 PM, Márcio Albuquerque
> <ma...@logann.com.br> wrote:
> > Hi Yegor,
> > Thank you for the reply.
> > I use poi-3.8-20120326.jar. I copied your code but no hyperlink is
> > generated when I set type = InteractiveInfoAtom.LINK_SlideNumber.
> > Do I have to get the last build from trunk?
> > Thanks!
> >
> > 2012/10/19 Yegor Kozlov <ye...@dinom.ru>
> >
> >> SlideShow ppt = new SlideShow();
> >>
> >> Slide slideA = ppt.createSlide();
> >> Slide slideB = ppt.createSlide();
> >>
> >> TextBox textBox = new TextBox();
> >> String text = "Go to Slide #2";
> >> textBox.setText(text);
> >> textBox.setAnchor(new Rectangle(100, 200, 200, 50));
> >>
> >> String href = slideB._getSheetNumber() + ",1,Link";
> >> Hyperlink hyperlink = new Hyperlink();
> >> hyperlink.setAddress(href);
> >> hyperlink.setTitle(textBox.getText());
> >> hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
> >> int linkId = ppt.addHyperlink(hyperlink);
> >>
> >> textBox.setHyperlink(hyperlink);
> >> slideA.addShape(textBox);
> >>
> >> FileOutputStream out = new FileOutputStream("hyperlink.ppt");
> >> ppt.write(out);
> >> out.close();
> >>
> >>
> >> On Fri, Oct 19, 2012 at 3:19 AM, Márcio Albuquerque
> >> <ma...@logann.com.br> wrote:
> >> > Hi!
> >> > I've seen in the hslf examples that it is possible to create a power
> >> point
> >> > hyperlink to an URL using POI.
> >> > I am wondering if it is also possible to create a hyperlink that
> points
> >> to
> >> > another slide.
> >> > Is it?
> >> > Thanks in advance.
> >> >
> >> > --
> >> > Marcio Brandão Albuquerque
> >> > Analista de Sistemas
> >> > LOGANN Soluções Especiais
> >> > (31) 2512-0965
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
> >
> >
> > --
> > Marcio Brandão Albuquerque
> > Analista de Sistemas
> > LOGANN Soluções Especiais
> > (31) 2512-0965
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Yegor Kozlov <ye...@dinom.ru>.
Please try with the latest build from trunk. I've just re-checked my
code and it works OK for me. I'm using MS Office 2010.
Yegor
On Fri, Oct 19, 2012 at 10:00 PM, Márcio Albuquerque
<ma...@logann.com.br> wrote:
> Hi Yegor,
> Thank you for the reply.
> I use poi-3.8-20120326.jar. I copied your code but no hyperlink is
> generated when I set type = InteractiveInfoAtom.LINK_SlideNumber.
> Do I have to get the last build from trunk?
> Thanks!
>
> 2012/10/19 Yegor Kozlov <ye...@dinom.ru>
>
>> SlideShow ppt = new SlideShow();
>>
>> Slide slideA = ppt.createSlide();
>> Slide slideB = ppt.createSlide();
>>
>> TextBox textBox = new TextBox();
>> String text = "Go to Slide #2";
>> textBox.setText(text);
>> textBox.setAnchor(new Rectangle(100, 200, 200, 50));
>>
>> String href = slideB._getSheetNumber() + ",1,Link";
>> Hyperlink hyperlink = new Hyperlink();
>> hyperlink.setAddress(href);
>> hyperlink.setTitle(textBox.getText());
>> hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
>> int linkId = ppt.addHyperlink(hyperlink);
>>
>> textBox.setHyperlink(hyperlink);
>> slideA.addShape(textBox);
>>
>> FileOutputStream out = new FileOutputStream("hyperlink.ppt");
>> ppt.write(out);
>> out.close();
>>
>>
>> On Fri, Oct 19, 2012 at 3:19 AM, Márcio Albuquerque
>> <ma...@logann.com.br> wrote:
>> > Hi!
>> > I've seen in the hslf examples that it is possible to create a power
>> point
>> > hyperlink to an URL using POI.
>> > I am wondering if it is also possible to create a hyperlink that points
>> to
>> > another slide.
>> > Is it?
>> > Thanks in advance.
>> >
>> > --
>> > Marcio Brandão Albuquerque
>> > Analista de Sistemas
>> > LOGANN Soluções Especiais
>> > (31) 2512-0965
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>
>
> --
> Marcio Brandão Albuquerque
> Analista de Sistemas
> LOGANN Soluções Especiais
> (31) 2512-0965
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Márcio Albuquerque <ma...@logann.com.br>.
Hi Yegor,
Thank you for the reply.
I use poi-3.8-20120326.jar. I copied your code but no hyperlink is
generated when I set type = InteractiveInfoAtom.LINK_SlideNumber.
Do I have to get the last build from trunk?
Thanks!
2012/10/19 Yegor Kozlov <ye...@dinom.ru>
> SlideShow ppt = new SlideShow();
>
> Slide slideA = ppt.createSlide();
> Slide slideB = ppt.createSlide();
>
> TextBox textBox = new TextBox();
> String text = "Go to Slide #2";
> textBox.setText(text);
> textBox.setAnchor(new Rectangle(100, 200, 200, 50));
>
> String href = slideB._getSheetNumber() + ",1,Link";
> Hyperlink hyperlink = new Hyperlink();
> hyperlink.setAddress(href);
> hyperlink.setTitle(textBox.getText());
> hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
> int linkId = ppt.addHyperlink(hyperlink);
>
> textBox.setHyperlink(hyperlink);
> slideA.addShape(textBox);
>
> FileOutputStream out = new FileOutputStream("hyperlink.ppt");
> ppt.write(out);
> out.close();
>
>
> On Fri, Oct 19, 2012 at 3:19 AM, Márcio Albuquerque
> <ma...@logann.com.br> wrote:
> > Hi!
> > I've seen in the hslf examples that it is possible to create a power
> point
> > hyperlink to an URL using POI.
> > I am wondering if it is also possible to create a hyperlink that points
> to
> > another slide.
> > Is it?
> > Thanks in advance.
> >
> > --
> > Marcio Brandão Albuquerque
> > Analista de Sistemas
> > LOGANN Soluções Especiais
> > (31) 2512-0965
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
--
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965
Re: Is it possible to create a power point hyperlink from one slide
to another?
Posted by Yegor Kozlov <ye...@dinom.ru>.
SlideShow ppt = new SlideShow();
Slide slideA = ppt.createSlide();
Slide slideB = ppt.createSlide();
TextBox textBox = new TextBox();
String text = "Go to Slide #2";
textBox.setText(text);
textBox.setAnchor(new Rectangle(100, 200, 200, 50));
String href = slideB._getSheetNumber() + ",1,Link";
Hyperlink hyperlink = new Hyperlink();
hyperlink.setAddress(href);
hyperlink.setTitle(textBox.getText());
hyperlink.setType(InteractiveInfoAtom.LINK_SlideNumber);
int linkId = ppt.addHyperlink(hyperlink);
textBox.setHyperlink(hyperlink);
slideA.addShape(textBox);
FileOutputStream out = new FileOutputStream("hyperlink.ppt");
ppt.write(out);
out.close();
On Fri, Oct 19, 2012 at 3:19 AM, Márcio Albuquerque
<ma...@logann.com.br> wrote:
> Hi!
> I've seen in the hslf examples that it is possible to create a power point
> hyperlink to an URL using POI.
> I am wondering if it is also possible to create a hyperlink that points to
> another slide.
> Is it?
> Thanks in advance.
>
> --
> Marcio Brandão Albuquerque
> Analista de Sistemas
> LOGANN Soluções Especiais
> (31) 2512-0965
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org