Javaexamples-create-blank-ppt

提供:Dev Guides
移動先:案内検索

Javaの例-空のPPTの作成

問題の説明

Javaを使用して空のPPTドキュメントを作成する方法。

溶液

以下は、Javaを使用して空のPPTドキュメントを作成するプログラムです。

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xslf.usermodel.XMLSlideShow;

public class CreatingBlankPPT {
   public static void main(String args[]) throws IOException {

     //creating a new empty slide show
      XMLSlideShow ppt = new XMLSlideShow();

     //creating an FileOutputStream object
      File file = new File("example1.pptx");
      FileOutputStream out = new FileOutputStream(file);

     //saving the changes to a file
      ppt.write(out);
      System.out.println("Presentation created successfully");
      out.close();
   }
}

結果

ブランクPPT