国产PPT格式控件Spire.Presentation功能演示:在Java中将PowerPoint形状保存为图像

本文介绍如何使用Spire.Presentation for Java将特定幻灯片中的形状导出为图像。

Spire.Presentation for Java 专业的 PowerPoint API,它允许开发人员在 Java 应用程序中创建、读取、写入、转换和保存 PowerPoint 文档,而无需安装 Microsoft PowerPoint。

本文介绍如何使用Spire.Presentation for Java将特定幻灯片中的形状导出为图像。可点击此处下载最新版测试。

这么优秀的国产工具怎能错过呢!想要获取更多福利的朋友咨询在线客服哦~


下面是示例PowerPoint文档的屏幕截图。

国产PPT格式控件Spire.Presentation功能演示:在Java中将PowerPoint形状保存为图像
import com.spire.presentation.ISlide;import com.spire.presentation.Presentation;import javax.imageio.ImageIO;import java.awt.*;import java.awt.image.BufferedImage;import java.io.File;public class SaveShapeAsImage {    public static void main(String[] args) throws Exception {        //Create a Presentation object        Presentation presentation = new Presentation();        //Load the sample PowerPoint file        presentation.loadFromFile("C:\Users\Administrator\Desktop\chart and table.pptx");        //Get the first slide        ISlide slide = presentation.getSlides().get(0);        //Declare a BufferedImage variable        BufferedImage image;        //Loop through the shapes in the slide        for (int i = 0; i < slide.getShapes().getCount(); i++) { //Save the specific shape as image data image = slide.getShapes().saveAsImage(i); //Write data to png file File file = new File(String.format("ToImage-%d.png", i)); ImageIO.write(image, "PNG", file); } } }

输出结果

国产PPT格式控件Spire.Presentation功能演示:在Java中添加、检测、删除 PPT 数字签名


还想要更多吗可以点击阅读【2020 · E-iceblue最新资源整合】查找需要的教程资源。是E-iceblue官方友好合作伙伴,如果您对spire.Presentation感兴趣,可以联系在线客服了解具体授权价格和使用机制。
标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月27日
下一篇 2021年1月27日

相关推荐

发表回复

登录后才能评论