本文整理汇总了Java中org.apache.poi.xslf.usermodel.XMLSlideShow.createSlide方法的典型用法代码示例。如果您正苦于以下问题:Java XMLSlideShow.createSlide方法的具体用法?Java XMLSlideShow.createSlide怎么用?Java XMLSlideShow.createSlide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.xslf.usermodel.XMLSlideShow
的用法示例。
在下文中一共展示了XMLSlideShow.createSlide方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithslides/moveslide/data/";
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(dataPath + "presentation.pptx"));
//add slides
ppt.createSlide();
ppt.createSlide();
ppt.createSlide();
XSLFSlide[] slides = ppt.getSlides();
ppt.setSlideOrder(slides[0], 4);
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "Apache_ReOrdered_Slides_Out.pptx");
ppt.write(out);
out.close();
System.out.println("Slides ReOrdered Successfuly.");
}
示例2: main
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithpresentation/openandsave/data/";
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(dataPath + "presentation.pptx"));
//append a new slide to the end
XSLFSlide blankSlide = ppt.createSlide();
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "EditedPPT_Apache_Out.pptx");
ppt.write(out);
out.close();
System.out.println("Presentation Edited and Saved.");
}
示例3: main
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithtext/hyperlinks/data/";
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
// assign a hyperlink to a text run
XSLFTextBox shape = slide.createTextBox();
XSLFTextRun r = shape.addNewTextParagraph().addNewTextRun();
r.setText("Apache POI");
XSLFHyperlink link = r.createHyperlink();
link.setAddress("http://poi.apache.org");
//save changes
FileOutputStream out = new FileOutputStream(dataPath + "Apache_Hyperlink_Out.ppt");
ppt.write(out);
out.close();
System.out.println("Presentation with hyperlink Saved.");
}
示例4: testDraw
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Test
public void testDraw() throws Exception {
VennFigure<String> vennFigure = new VennFigure<>();
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(0, 0), 0, 100, 100));
vennFigure.addShape(new VennFigure.Text<>(new VennFigure.Point(0, 0), "Normal"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(50, 50), 0, 50, 100));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(200, 200), Math.PI / 4, 50, 100));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 0), 0, 50, 20, "#00ff00ff"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 20), 0, 50, 20, "#ff0000ff"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 40), 0, 50, 20, "#0000ffff"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 60), 0, 50, 20, "#00ff0050"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 80), 0, 50, 20, "#00ff0020"));
vennFigure.addShape(new VennFigure.Oval<>(new VennFigure.Point(150, 100), 0, 50, 20, "#00ff00"));
vennFigure.addShape(new VennFigure.Text<>(new VennFigure.Point(200, 200), "Rotated"));
vennFigure.addShape(new VennFigure.Text<>(new VennFigure.Point(100, 100), "Center"));
vennFigure.addShape(new VennFigure.Text<>(new VennFigure.Point(100, 120), "Left", VennFigure.TextJust.LEFT));
vennFigure.addShape(new VennFigure.Text<>(new VennFigure.Point(100, 140), "Right", VennFigure.TextJust.RIGHT));
XMLSlideShow slideShow = new XMLSlideShow();
XSLFSlideMaster slideMaster = slideShow.getSlideMasters()[0];
VennDrawSlides<String> drawSlides = new VennDrawSlides<>(vennFigure, slideShow.createSlide(slideMaster.getLayout(SlideLayout.TITLE_ONLY)));
drawSlides.draw();
try (FileOutputStream fos = new FileOutputStream(new File(DIST_DIR, "test.pptx"))) {
slideShow.write(fos);
}
}
示例5: exportAsPowerPoint
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static <T, U> void exportAsPowerPoint(VennFigureParameters<T> parameters, File file) throws IOException {
XMLSlideShow slideShow = new XMLSlideShow();
XSLFSlide slide = slideShow.createSlide();
VennDrawSlides<T> vennDrawSlides = new VennDrawSlides<>(VennFigureCreator.createVennFigure(parameters), slide);
vennDrawSlides.draw();
try (OutputStream os = new FileOutputStream(file)) {
slideShow.write(os);
}
}
示例6: main
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithslides/createslideswithdifferentlayout/data/";
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(dataPath + "presentation.pptx"));
// blank slide
ppt.createSlide();
// there can be multiple masters each referencing a number of layouts
// for demonstration purposes we use the first (default) slide master
XSLFSlideMaster defaultMaster = ppt.getSlideMasters()[0];
// title slide
XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);
// fill the placeholders
XSLFSlide slide1 = ppt.createSlide(titleLayout);
// title and content
XSLFSlideLayout titleBodyLayout = defaultMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);
XSLFSlide slide2 = ppt.createSlide(titleBodyLayout);
FileOutputStream out = new FileOutputStream(dataPath + "Apache_Layouts_Out.pptx");
ppt.write(out);
out.close();
System.out.println("Layout slides created Successfuly.");
}
示例7: main
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
String dataPath = "src/featurescomparison/workingwithtext/formattext/data/";
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
XSLFTextBox shape = slide.createTextBox();
XSLFTextParagraph p = shape.addNewTextParagraph();
XSLFTextRun r1 = p.addNewTextRun();
r1.setText("The");
r1.setFontColor(Color.blue);
r1.setFontSize(24);
XSLFTextRun r2 = p.addNewTextRun();
r2.setText(" quick");
r2.setFontColor(Color.red);
r2.setBold(true);
XSLFTextRun r3 = p.addNewTextRun();
r3.setText(" brown");
r3.setFontSize(12);
r3.setItalic(true);
r3.setStrikethrough(true);
XSLFTextRun r4 = p.addNewTextRun();
r4.setText(" fox");
r4.setUnderline(true);
//save changes in a file
FileOutputStream out = new FileOutputStream(dataPath + "Formatted_Text_Apache_Out.pptx");
ppt.write(out);
out.close();
System.out.println("Presentation Formatted and Saved.");
}
示例8: createSlide
import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
protected XSLFSlide createSlide(XMLSlideShow ppt) {
XSLFSlideMaster defaultMaster = ppt.getSlideMasters().get(0);
XSLFSlideLayout layout = defaultMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);
return ppt.createSlide(layout);
}