发布网友 发布时间:2022-04-22 00:55
共1个回答
热心网友 时间:2022-04-21 22:06
我们当然要使用Com组件了,所以要先安装powerpoint2000,在VS.NET里面添加一个refrence,找到microsoft PowerPoint object library 9.0,添加进来。using System; using Office; using PowerPoint; namespace CourseServer.Course { ///<summary>/// Author:王洪超 /// Version:1.0 /// Date:2001/6/9 /// Description:转换PowerPoint的PPT文件为HTML文件 ///</summary>publicclass ConvertPowerPoint { ///<summary>/// 建立对PowerPoint.Application的Com组件的引用 ///</summary>private PowerPoint.Application ppt; ///<summary>/// 指向具体的文件; ///</summary>private PowerPoint.Presentation pptFile; privatestring _HtmlFileName; ///<summary>/// 只写属性,设置另存的HTML文件的文件路径 ///</summary>publicstring HtmlFileName { set { _HtmlFileName=value; } } ///<summary>/// 构造器 ///</summary>public ConvertPowerPoint() { //// TODO: Add constructor logic here // ppt=new PowerPoint.Application(); } ///<summary>/// 转换过程 ///</summary>///<param name="pptFileName">欲转换的PowerPoint文件名称</param>publicvoid Convert(string pptFileName) { pptFile=ppt.Presentations.Open(pptFileName,Office.MsoTriState.msoTrue,Office.MsoTriState.msoCTrue,Office.MsoTriState.msoFalse); pptFile.SaveAs(_HtmlFileName,PowerPoint.PpSaveAsFileType.ppSaveAsHTML,Office.MsoTriState.msoCTrue); pptFile.Close(); } } }点此发表你的看法>>【已有位网友发表了看法】