1
public boolean PptExport2Png(String filePath,String exportPath){
    Boolean flag = false;
    ActiveXComponent component = new ActiveXComponent("PowerPoint.Application");
    try{
        Dispatch presentations = component.getProperty("Presentations").toDispatch();

        Dispatch presentation = Dispatch.call(presentations, "Open", new Variant(filePath),
                new Variant(-1), new Variant(-1), new Variant(0))
                .toDispatch();
        Dispatch.call(presentation,"Export",new Variant(exportPath),new Variant(720),new Variant(540));

    }catch (Exception e){
        System.out.println("|||" + e.toString());
    }finally {

    }
    return false;
}

public static void main(String[] strs)throws Exception{
    String filePath="D://ppttest.ppt";
    String pngPath="D://folder22";
    JacobPptUtils jac = new JacobPptUtils(filePath,true);
    jac.PptExport2Png(filePath,pngPath);
}

I found that when i was using JACOB to export the ppt ,now,i have no any idea.please,give me some advice to deal it.

Here are the way where i has try: 1. to modify the file path expression

oracle
  • 11
  • 2

1 Answers1

0
 public static void main(String args[]) throws Exception{
   source = "D:/test.ppt" ;
    dest = "D:/xxx.pdf" ;
    File file = new File(source);

    if(!file.exists()){
        throw new Exception("error");
    }
    ppt2Pdf(source,dest);

   }
}
Michael
  • 2,631
  • 2
  • 24
  • 40
kyo
  • 1
  • 1