You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Lo...@log-net.com on 2012/06/08 01:09:41 UTC
merging pptx drops template
I just noticed that when I merged pptx files (creating a new pptx), the
slide templates are gone. The code I am using is basically:
XMLSlideShow newppt = new XMLSlideShow();
for(String ndx : deckIndexes) {
int iNdx = Integer.parseInt(ndx);
XSLFSlide slide = coreSlides[iNdx];
if(slide!=null) {
newppt.createSlide().importContent(slide); //THIS IS THE
CODE!!!
}
}
I'm guessing I'm going to have to dip deeper into the slides, but I want
to be 100% sure before I go down that road.
Thanks,
Lou
Re: merging pptx drops template
Posted by Yegor Kozlov <ye...@dinom.ru>.
A slide contents consists of two components:
1. shapes that actually present on the slide
2. shapes defined on the slide master. For example, if slide master
has a picture background then all slides that follow it will show this
picture even if the picture is not physically defined on the slide.
Slide#importContent imports (1), that is, it imports only the actual
slide contents.
In theory this approach can be used for master sheets too, but it
wasn't tested. Try to get slide's layout and slide's master and call
importContent on them. What is the result?
Yegor
On Fri, Jun 8, 2012 at 3:09 AM, <Lo...@log-net.com> wrote:
> I just noticed that when I merged pptx files (creating a new pptx), the
> slide templates are gone. The code I am using is basically:
>
> XMLSlideShow newppt = new XMLSlideShow();
> for(String ndx : deckIndexes) {
> int iNdx = Integer.parseInt(ndx);
> XSLFSlide slide = coreSlides[iNdx];
> if(slide!=null) {
> newppt.createSlide().importContent(slide); //THIS IS THE
> CODE!!!
> }
> }
>
> I'm guessing I'm going to have to dip deeper into the slides, but I want
> to be 100% sure before I go down that road.
>
> Thanks,
> Lou
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: merging pptx drops template
Posted by Lo...@log-net.com.
I think I may have solved my own issue by simply creating the new slide
show a different way:
XMLSlideShow newppt = coreppt;
XSLFSlide[] newSlides = newppt.getSlides();
for(int slideIndex=newSlides.length-1;slideIndex>=0;slideIndex--) {
if(deckIndexes.contains(Integer.toString(slideIndex))) {
//deckIndexes is a list of slide indexes that must be in the new show -
basically a filter
//do nothing - keep the slide
} else {
newppt.removeSlide(slideIndex);
}
}
This seems to be working OK. If anyone sees anything I am missing, please
let me know.
-Lou
Louis.Masters@log-net.com wrote on 2012-06-07 07:09:41 PM:
> Louis.Masters@log-net.com
> 2012-06-07 07:10 PM
>
> Please respond to
> "POI Users List" <us...@poi.apache.org>
>
> To
>
> user@poi.apache.org,
>
> cc
>
> Subject
>
> merging pptx drops template
>
> I just noticed that when I merged pptx files (creating a new pptx), the
> slide templates are gone. The code I am using is basically:
>
> XMLSlideShow newppt = new XMLSlideShow();
> for(String ndx : deckIndexes) {
> int iNdx = Integer.parseInt(ndx);
> XSLFSlide slide = coreSlides[iNdx];
> if(slide!=null) {
> newppt.createSlide().importContent(slide); //THIS IS
THE
> CODE!!!
> }
> }
>
> I'm guessing I'm going to have to dip deeper into the slides, but I want
> to be 100% sure before I go down that road.
>
> Thanks,
> Lou