您的位置:首页 > 编程语言 > C#

使用C#创建PowerPoint文档

2008-04-18 23:45 489 查看
using System;

using System.Collections.Generic;

using System.IO;

using System.Text;

using PPT = Microsoft.Office.Interop.PowerPoint; //11.0-2003,12.0-2007

namespace CreatePPTDemo

{

calss Program

{

static void Main(string[] args)

{

string path;

PPT.Application pptApp;

PPT.Presentation pptDoc;

path = @"d:/test.ppt"; //path = @"d:/test.pps";

pptApp = new PPT.ApplicationClass();

if(File.Exists(path))

{

File.Delete(path);

}

Object nothing = Missing.Value;

pptDoc = pptApp.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse);

PPT.PpSaveAsFileType format = PPT.PpSaveAsFileType.ppSaveAsDefault;

//PPT.PpSaveAsFileType.ppSaveAsShow;

pptDoc.SaveAs(path,format,Microsoft.Office.Core.MsoTriState.msoFalse);

pptDoc.Close();

pptApp.Quit();

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: