Thank you so much! I owe you a beer.

2012/10/24 Yegor Kozlov <[email protected]>

> 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
> <[email protected]> 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 <[email protected]>
> >
> >> > 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: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
> >
> >
> > --
> > Marcio Brandão Albuquerque
> > Analista de Sistemas
> > LOGANN Soluções Especiais
> > (31) 2512-0965
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Marcio Brandão Albuquerque
Analista de Sistemas
LOGANN Soluções Especiais
(31) 2512-0965

Reply via email to