C#怎么将ppt文件里的第一页转换为图片保存起来
下面是我写的代码
public void GetPPTThumbnailImage1(string mPath, string tName)
{
string tPath =Server.MapPath("../ThumbnailImage/") + tName;
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var ppt = app.Presentations.Open(mPath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse); //这里总是显示为空 ,好像没有读取到文件
Microsoft.Office.Interop.PowerPoint.Slide slid = ppt.Slides.FindBySlideID(1);
slid.Export(tPath + string.Format("page{0}.png", 1), "png", 1024, 768); //程序走到这时总是报错“未将对象引用设置到对象的实例。”
ppt.Close();
app.Quit();
GC.Collect();
}
该如何修改呢,或者有其他的解决方法吗