[prev in list] [next in list] [prev in thread] [next in thread]
List: poi-user
Subject: Re: Is it possible to create a power point hyperlink from one slide to another?
From: Yegor Kozlov <yegor.kozlov () dinom ! ru>
Date: 2012-10-24 12:22:21
Message-ID: CAAwi-j_pjv6mCvPyGPbxOsJRgKYJBOjO3G=v5u2WA3reGny+Jg () mail ! gmail ! com
[Download RAW message or body]
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
<marcio.albuquerque@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 <yegor.kozlov@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic