You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by honyk <j....@email.cz> on 2013/08/20 08:30:36 UTC

RE: [XSLF] Duplicating theme

On 2013-07-03 honyk wrote:
> 
> for adding notes to slides I have to duplicate any current theme (e.g.
> theme1.xml => theme2.xml).
> 
> 
> I do it this way:
> 
> in XMLSlideShow:
> 
> Integer themeIndex = 0;
> for (POIXMLDocumentPart p : getRelations()) {
>     if (p instanceof XSLFTheme) {
>         themeIndex++;
>     }
> }
> 
> // create a new theme with the calculated index (but it is not ensured
> it is
> unique)
> XSLFTheme theme = (XSLFTheme) createRelationship(XSLFRelation.THEME,
>         XSLFFactory.getInstance(), themeIndex + 1);
> 
> // import the complete content of the first slide theme.
> theme.importTheme(getSlides()[0].getTheme());
> 
> 
> in XSLFTheme
> 
> public void importTheme(XSLFTheme theme) {
>   _theme = theme.getXmlObject();
>   _schemeColors = theme._schemeColors;
> }
> 
> 
> Or is there a better way?
> 

I can sum it into two questions:
1. How can I retrieve a unique theme index?
2. Is there any more efficient way to clone the existing theme?

Thanks, Jan


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