国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

asp.net將ppt文檔轉換成pdf

2019-11-17 01:52:12
字體:
來源:轉載
供稿:網友

asp.net將PPT文檔轉換成pdf

一、添加引用

usingMicrosoft.Office.Core;usingMicrosoft.Office.Interop.Powerpoint;

二、轉換方法

C# 代碼 復制
    ///<summary>            /// 把PowerPoint文件轉換成PDF格式文件           ///</summary>            ///<param name="sourcePath">源文件路徑</param>         ///<param name="targetPath">目標文件路徑</param>     ///<returns>成功返回true,失敗返回false</returns>     public static bool PPTConvertToPDF(string sourcePath, string targetPath)    {        bool result;        PpSaveAsFileType ppSaveAsFileType = PpSaveAsFileType.ppSaveAsPDF;//轉換成pdf        object missing = Type.Missing;        Microsoft.Office.Interop.PowerPoint.applicationClass application = null;        PResentation persentation = null;        try        {            application = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();            persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);            if (persentation!=null)            {                persentation.SaveAs(targetPath, ppSaveAsFileType, MsoTriState.msoTrue);            }            result = true;        }        catch        {            result = false;        }        finally        {            if (persentation != null)            {                persentation.Close();                persentation = null;            }            if (application != null)            {                application.Quit();                application = null;            }        }        return result;    }

三、調用

OfficeToPdf.PPTToPDF("d://12345。pptx","d://12345。pdf");


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天等县| 鹤壁市| 屏山县| 连云港市| 彝良县| 惠水县| 玉门市| 全州县| 简阳市| 开化县| 许昌县| 嵊州市| 阿鲁科尔沁旗| 闽侯县| 娱乐| 博白县| 二连浩特市| 苍梧县| 宜良县| 池州市| 平安县| 卢氏县| 孟津县| 沙坪坝区| 武安市| 海伦市| 调兵山市| 郁南县| 天门市| 峨眉山市| 景宁| 乌什县| 庄浪县| 临泉县| 临猗县| 永福县| 夏邑县| 稻城县| 望谟县| 澄迈县| 霍山县|