//jacob的几个包
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComFailException;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
//srcPath源文件 destPath 生成文件
public static boolean interceptPPT(String srcPath, String destPath) {
ActiveXComponent app = null;
try {
ComThread.InitSTA();
app = new ActiveXComponent("PowerPoint.Application");
ActiveXComponent presentations = app.getPropertyAsComponent("Presentations");
ActiveXComponent presentation = presentations.invokeGetComponent("Open", new Variant(srcPath), new Variant(false));
int count=Dispatch.get(presentations, "Count").getInt();
System.out.println("打开文档数:"+count);
ActiveXComponent slides = presentation.getPropertyAsComponent("Slides");
int slid
Jacob操作ppt--截取ppt部分页内容
最新推荐文章于 2024-05-11 10:10:04 发布
该博客介绍了如何利用Jacob库在Java中操作PowerPoint,裁剪PPT内容,删除指定页数,以实现保留幻灯片的20%内容,并保存为新的PPT文件。
摘要由CSDN通过智能技术生成