当前位置: 首页>>代码示例>>Java>>正文


Java XMLSlideShow.write方法代码示例

本文整理汇总了Java中org.apache.poi.xslf.usermodel.XMLSlideShow.write方法的典型用法代码示例。如果您正苦于以下问题:Java XMLSlideShow.write方法的具体用法?Java XMLSlideShow.write怎么用?Java XMLSlideShow.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.xslf.usermodel.XMLSlideShow的用法示例。


在下文中一共展示了XMLSlideShow.write方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
public void write(JSONObject object, OutputStream outputStream) {
    if (validator.isEmpty(object) || !object.containsKey("slides"))
        return;

    XMLSlideShow xmlSlideShow = new XMLSlideShow();
    setSize(xmlSlideShow, object);
    slides(xmlSlideShow, object.getJSONArray("slides"));

    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.MILLISECOND, -1 * (calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)));
    String time = dateTime.toString(calendar.getTime(), "yyyy-MM-dd'T'HH:mm:ss'Z'");
    xmlSlideShow.getProperties().getCoreProperties().setCreated(time);
    xmlSlideShow.getProperties().getCoreProperties().setModified(time);

    try {
        xmlSlideShow.write(outputStream);
    } catch (IOException e) {
        logger.warn(e, "输出PPTx到输出流时发生异常!");
    }
}
 
开发者ID:heisedebaise,项目名称:tephra,代码行数:22,代码来源:PptxImpl.java

示例2: createXMLSlideShowFileSimpleImages

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
/**
 * @작성자 : KYJ
 * @작성일 : 2017. 10. 18.
 * @param pptFile
 * @param images
 * @throws IOException
 * @Deprecated 처리되지않는 함수 존재.
 */
@Deprecated
public static void createXMLSlideShowFileSimpleImages(File pptFile, File... images) throws IOException {

	XMLSlideShow ppt = new XMLSlideShow();
	for (File image : images) {

		CreateXmlSlideImageHandler handler = new DefaultXmlSlideCreateImageHandler(ppt);
		handler.createImage(image);
	}

	try (FileOutputStream stream = new FileOutputStream(pptFile)) {
		ppt.write(stream);
	}

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:PPTUtil.java

示例3: 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.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:22,代码来源:ApacheMoveSlides.java

示例4: 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.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:17,代码来源:ApacheOpenandSave.java

示例5: 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.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:22,代码来源:ApacheHyperlink.java

示例6: 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);
    }
}
 
开发者ID:informationsea,项目名称:VennDraw,代码行数:10,代码来源:VennExporter.java

示例7: 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);
    }
}
 
开发者ID:informationsea,项目名称:VennDraw,代码行数:28,代码来源:VennDrawSlidesTest.java

示例8: 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.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:29,代码来源:ApacheAddLayoutSlides.java

示例9: main

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args)throws Exception
{
	String dataPath = "src/featurescomparison/workingwithpresentation/deleteslides/data/";
	
	XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(dataPath + "presentation.pptx"));
	
	ppt.removeSlide(0); // 0-based index of a slide to be removed
	
	FileOutputStream out = new FileOutputStream(dataPath + "DeleteSlide_Apache_Out.ppt");
	ppt.write(out);
	out.close();
	
	//Printing the status
       System.out.println("Slide removed successfully!");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:16,代码来源:ApacheDeleteSlides.java

示例10: 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.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:38,代码来源:ApacheFormatting.java

示例11: save

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
public void save(File file) throws IOException {
    XMLSlideShow presentation = (XMLSlideShow) getDocument();
    try (FileOutputStream pptxOutputStream = new FileOutputStream(file)) {
        presentation.write(pptxOutputStream);
    }
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:8,代码来源:PptxDataObject.java


注:本文中的org.apache.poi.xslf.usermodel.XMLSlideShow.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。