代码如下:
 FUpload.SaveAs(uploadPath + "\\" + dlistClass.SelectedItem.Text + "\\" + newFileName);
                //如果存储文件类型为ppt,pps,pptx则需要另存一个htm格式的文件以便支持在线浏览功能。
                if (FileOpt.GetFileType(oldFileName) == ".ppt" || FileOpt.GetFileType(oldFileName) == ".pptx" || FileOpt.GetFileType(oldFileName) == ".pps")
                {                    ConvertToHTML(sonPath + "\\" + newFileName, pptToHtml + "\\" + newFileName);
                }
                return true;
/// <summary>
/// 将PPT文件转换为htm
/// </summary>
    /// <param name="PptFilePath">PPT文件的绝对路径</param>
    /// <param name="HtmFilePath">htm文件的绝对路径</param>
    public void ConvertToHTML(string PptFilePath, string HtmFilePath)
    {
        string pptPath = PptFilePath;
        string htmlFileName = HtmFilePath.Substring(0,HtmFilePath.Length-Path.GetExtension(HtmFilePath).Length) + ".htm";
        Label1.Text = "打开文档中请稍等";
//执行到这里程序就终止了。在vs的调试模式或自带的web服务器上运行正常,移植到iis中就无法得到正常执行了。
        PPT.ApplicationClass ppta = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
        try
        {
            PPT.Presentation pptFile;            pptFile = ppta.Presentations.Open(pptPath, MsoTriState.msoCTrue, MsoTriState.msoCTrue, MsoTriState.msoFalse);
            Label1.Text = "保存文档中请稍等。。";
            pptFile.SaveAs(htmlFileName, PPT.PpSaveAsFileType.ppSaveAsHTML, MsoTriState.msoTriStateToggle);
            Label1.Text = "操作完成!";
            pptFile.Close();
            ppta.Quit();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }

解决方案 »

  1.   

    执行到这里程序就终止了。在vs的调试模式或自带的web服务器上运行正常,移植到iis中就无法得到正常执行了。
    ------------------------------------------------------
    是不是IIS用户权限不够
      

  2.   

    应该是没有权限在服务器上保存文件吧.把Internet匿名帐户设成对FileUpload保存的文件夹为完全控制
      

  3.   

    FUpload.SaveAs(uploadPath + "\\" + dlistClass.SelectedItem.Text + "\\" + newFileName); 这条语句可以正常执行,文件得到正确保存!
      

  4.   

    PPT声明为什么了?可以参考我下面这段代码:
    using Microsoft.Office;
    using Microsoft.Office.Interop.PowerPoint;
    using Microsoft.Office.Interop;
    using Microsoft.Office.Core;public class ConvertPowerPoint
    {
        /// <summary>
        /// 建立对PowerPoint.Application的Com组件的引用
        /// </summary>
        private Microsoft.Office.Interop.PowerPoint.Application ppt;
        /// <summary>
        /// 指向具体的文件;
        /// </summary>
        private Microsoft.Office.Interop.PowerPoint.Presentation pptFile;    /// <summary>
        /// 构造器
        /// </summary>
        public ConvertPowerPoint()
        {
            ppt = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
        }
        /// <summary>
        /// 转换过程
        /// </summary>
        /// <param name="pptFileName">欲转换的PowerPoint文件名称</param>    public void Convert(string pptFileName)
        {
            //ppt.Presentations.OpenOld();
            if (ppt == null)
                return;
            pptFile = ppt.Presentations.Open(pptFileName, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
            pptFile.SaveAs("e:\\Project2008\\PPT_Test\\1.html", Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsHTML, Microsoft.Office.Core.MsoTriState.msoCTrue);
            pptFile.Close();
        }
    }其中:"e:\\Project2008\\PPT_Test\\1.html” 就是你的<param name="HtmFilePath">htm文件的绝对路径 </param>
      

  5.   

    using PPT=Microsoft.Office.Interop.PowerPoint; 
    到底是怎么回事郁闷中……