gpt4 book ai didi

java - JACOB:Presentation.Export:PowerPoint 无法将 ^0 保存到 ^1

转载 作者:太空宇宙 更新时间:2023-11-04 12:34:24 25 4
gpt4 key购买 nike

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);
}

我发现当我使用JACOB导出ppt时,我现在没有任何想法。请给我一些处理建议。

这是我尝试过的方法:1.修改文件路径表达式

最佳答案

 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);

}
}

关于java - JACOB:Presentation.Export:PowerPoint 无法将 ^0 保存到 ^1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37479323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com