zoukankan      html  css  js  c++  java
  • Aspose系列实现docx转PDF,PPT转PDF,EXCEL转PDF

    没有什么营养,就是调用一下这个组件。其实一开始用的是Microsoft.Office.Interop.Excel;Microsoft.Office.Interop.Word

     但是在服务器要注意,服务器要安装Office的指定版本,具体是哪个版本要看你引用的版本。

    而且在服务器调用+com组件,对权限有很多要求。网上有很多答案了,这里主要说aspose

    using Aspose.Cells;//Excel
    using Aspose.Slides;//PPT

    public static void ppt2Pdf(string filePath,string savePath){
    Presentation ppt = new Presentation(filePath);
    ppt.Save(savePath, Aspose.Slides.Export.SaveFormat.Pdf);

    }


    public static void excel2Pdf(string filePath, string savePath)
    {

    Workbook excel = new Workbook(filePath);
    excel.Save(savePath, Aspose.Cells.SaveFormat.Pdf);
    }

    using Aspose.Words; 

    Document doc = new Document(serverPath);
    doc.Save(savePath);

    DLL的网盘:链接: http://pan.baidu.com/s/1bBeizs 密码: wfzh

     自己引用转换就可以了

    不过不管微软的组件还是Aspose都有缺点。马上给大家分享NPOI 

    使用 NPOI 你就可以在没有安装 Office 或者相应环境的机器上对 WORD/EXCEL 文档进行读写

  • 相关阅读:
    Git学习笔记06-版本回退
    python3+selenium入门07-元素等待
    [cerc2017J]Justified Jungle
    [codeforces126B]Password
    计算几何基础模板
    floyd路径记录
    [数据结构复习]层序建立二叉树
    [patl2-011]玩转二叉树
    [poj3348]Cows
    [poj3347]Kadj Squares
  • 原文地址:https://www.cnblogs.com/liuwenxu/p/6278912.html
Copyright © 2011-2022 走看看