如何使用apache poi为幻灯片设置不同的幻灯片切换效果
how to set a different slide transition effect for the slide by use apache poi
最近在做一个功能,用apache poi
导出powerpoint
,
我想为幻灯片设置不同的幻灯片切换效果,但是在apache api
中找不到任何方法,有没有人做过这样的事情?
请告诉我,谢谢!
我的英语不是很好。我希望你能阅读它。 XD
无法在 XSLFSlide and XSLFSheet until now. So we would need using the underlying low level objects of ooxml-schemas-1.4
. Unfortunately there is no documentation for ooxml-schemas
public available. That's why we need downloading the sources 中设置转换并从中执行 javadoc
。
然后我们发现 CTSlide
具有 addNewTransition()
和 CTSlideTransition
具有不同的过渡元素,例如 "blinds" 元素、"checker" 元素、"circle"元素,...
示例:
import java.io.FileOutputStream;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.sl.usermodel.*;
import java.awt.Color;
public class CreatePPTXSheetsTransition {
public static void main(String[] args) throws Exception {
XMLSlideShow slideShow = new XMLSlideShow();
XSLFSlide slide = slideShow.createSlide();
if (slide.getXmlObject().getCSld().getBg() == null) slide.getXmlObject().getCSld().addNewBg();
slide.getBackground().setFillColor(Color.BLUE);
slide.getXmlObject().addNewTransition().addNewDissolve();
slide = slideShow.createSlide();
if (slide.getXmlObject().getCSld().getBg() == null) slide.getXmlObject().getCSld().addNewBg();
slide.getBackground().setFillColor(Color.RED);
slide.getXmlObject().addNewTransition().addNewWheel().setSpokes(8);
FileOutputStream out = new FileOutputStream("CreatePPTXSheetsTransition.pptx");
slideShow.write(out);
out.close();
}
}
最近在做一个功能,用apache poi
导出powerpoint
,
我想为幻灯片设置不同的幻灯片切换效果,但是在apache api
中找不到任何方法,有没有人做过这样的事情?
请告诉我,谢谢!
我的英语不是很好。我希望你能阅读它。 XD
无法在 XSLFSlide and XSLFSheet until now. So we would need using the underlying low level objects of ooxml-schemas-1.4
. Unfortunately there is no documentation for ooxml-schemas
public available. That's why we need downloading the sources 中设置转换并从中执行 javadoc
。
然后我们发现 CTSlide
具有 addNewTransition()
和 CTSlideTransition
具有不同的过渡元素,例如 "blinds" 元素、"checker" 元素、"circle"元素,...
示例:
import java.io.FileOutputStream;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.sl.usermodel.*;
import java.awt.Color;
public class CreatePPTXSheetsTransition {
public static void main(String[] args) throws Exception {
XMLSlideShow slideShow = new XMLSlideShow();
XSLFSlide slide = slideShow.createSlide();
if (slide.getXmlObject().getCSld().getBg() == null) slide.getXmlObject().getCSld().addNewBg();
slide.getBackground().setFillColor(Color.BLUE);
slide.getXmlObject().addNewTransition().addNewDissolve();
slide = slideShow.createSlide();
if (slide.getXmlObject().getCSld().getBg() == null) slide.getXmlObject().getCSld().addNewBg();
slide.getBackground().setFillColor(Color.RED);
slide.getXmlObject().addNewTransition().addNewWheel().setSpokes(8);
FileOutputStream out = new FileOutputStream("CreatePPTXSheetsTransition.pptx");
slideShow.write(out);
out.close();
}
}