You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by mond <ml...@mond.me.uk> on 2008/09/03 18:08:34 UTC

Slide templates and layout

Hi

Two related questions:

1). When I create a new slideshow based upon an existing template, adding a
title to a slide does not place it correctly. I guess that it doesn't adhere
to the layout template, which leads me on to my next question...

2). How do you create a slide based upon the slide layout templates that you
get in PP? E.g. title slide, title and text, title 2-column text. Since when
I create a new slideshow from an existing PP template using HSLF and add
slides, I would have to make sure all the alignment was consistent across
the deck and it would likely not look the same as presentations created
using PP normally (like above).

E.g. It would be really nice to create a new slide based upon a title and
text template using code like:

ppt = new SlideShow(new HSLFSlideShow("H:\\doc\\tmp.pot"))
s1 = new SlideTextAndTitle("Title", "Here\rAre\rSome\rBullet\rPoints")
ppt.add(s1)
ppt.save("C:\\slideshow.ppt")

Does something like this exist? How do these slide layouts work in PP? Are
they based upon parameters set when designing the template? If so, can they
be extracted to be used in creating the textboxes in SlideTextAndTitle
above?

Thanks,

d

Re: Slide templates and layout

Posted by Yegor Kozlov <ye...@dinom.ru>.
HSLF does not yet support creation of slides with predefined layout. For now it can create only blank slides.

Predefined layouts are based on the master slide settings. If you open slide master you will see two placeholders, one 
for title and the other for text body. The position of the placeholder text in a slide is defined by the position of the 
corresponding placeholder in the master slide. 2-column text has half of the size of the master body text placeholder, 
etc.

It shouldn't be hard to add this functionality. The user code may look like this:


Slide slide = ppt.createSlide(Slide.LAYOUT_TITLE_AND_TEXT);

TextShape title = slide.getPlaceholder(Slide.PLACEHOLDER_TITLE);
title.getTextRun().setText("Hello, World");

TextShape body = slide.getPlaceholder(Slide.PLACEHOLDER_BODYTEXT);
title.getTextRun().setText("Here\rAre\rSome\rBullet\rPoints");

I will see if it can be added.

Yegor

> Hi
> 
> Two related questions:
> 
> 1). When I create a new slideshow based upon an existing template, adding a
> title to a slide does not place it correctly. I guess that it doesn't adhere
> to the layout template, which leads me on to my next question...
> 
> 2). How do you create a slide based upon the slide layout templates that you
> get in PP? E.g. title slide, title and text, title 2-column text. Since when
> I create a new slideshow from an existing PP template using HSLF and add
> slides, I would have to make sure all the alignment was consistent across
> the deck and it would likely not look the same as presentations created
> using PP normally (like above).
> 
> E.g. It would be really nice to create a new slide based upon a title and
> text template using code like:
> 
> ppt = new SlideShow(new HSLFSlideShow("H:\\doc\\tmp.pot"))
> s1 = new SlideTextAndTitle("Title", "Here\rAre\rSome\rBullet\rPoints")
> ppt.add(s1)
> ppt.save("C:\\slideshow.ppt")
> 
> Does something like this exist? How do these slide layouts work in PP? Are
> they based upon parameters set when designing the template? If so, can they
> be extracted to be used in creating the textboxes in SlideTextAndTitle
> above?
> 
> Thanks,
> 
> d
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org