合并2个PPT【Access,word同理】(来自www.yesur.com)

using System;
using System.Xml;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using PowerPoint;
using Microsoft.Office;
using Microsoft.Office.Core;
namespace cmd
{
///

1<summary>   
2/// opPPT 的摘要说明。   
3/// </summary>

public class opPPT : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
PowerPoint.ApplicationClass oPP = new PowerPoint.ApplicationClass();
oPP.Visible = MsoTriState.msoTrue;
PowerPoint.Presentations oPresSet = oPP.Presentations;
PowerPoint._Presentation oPres = oPresSet.Open("c:\\a.ppt",MsoTriState.msoFalse, MsoTriState.msoFalse,MsoTriState.msoTrue);
oPres.Slides.InsertFromFile("c:\\b.ppt",oPres.Slides.Count,1,-1);

// Run

oPres.SaveAs("c:\\yesur.ppt",PowerPoint.PpSaveAsFileType.ppSaveAsDefault,MsoTriState.msoCTrue);

// Quit PowerPoint and clean up.
oPres.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject (oPres);
oPres = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject (oPresSet);
oPresSet = null;
oPP.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject (oPP);
oPP = null;

}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

///

1<summary>   
2/// 设计器支持所需的方法 - 不要使用代码编辑器修改   
3/// 此方法的内容。   
4/// </summary>


private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus