I have seen a powerpoint presentation (ppt) somewhere online which was a .ppt file and it ran within the web browser. So no need for exporting to html, swf, etc and it 开发者_JAVA百科was rather good quality when it came to images.
Any ideas how to do this?
Try this code
string ExportLocation = "C:\\Sample";
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
ppApp.Visible = MsoTriState.msoTrue;
ppApp.WindowState = PpWindowState.ppWindowMinimized;
Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open("C:\\ScreenShots.ppt",
MsoTriState.msoFalse, MsoTriState.msoFalse,
MsoTriState.msoFalse);
ppApp.ShowWindowsInTaskbar = MsoTriState.msoFalse; //Hiding the application; But it will be displayed always
try
{
Slides objSlides = oPres.Slides; //Getting all the slides
for (int i = 1; i < objSlides.Count - 1; i++)
{
string file = Path.Combine(ExportLocation, string.Format("{0}.{1}", objSlides[i].Name, "jpg"));
oPres.Slides[i].Export(file, "jpg", 800, 600);
}
}
finally
{
ppApp.Quit(); //Closing the Powerpoint application. Sometimes it won't work too.
}
For a single presentation you can use Google Docs' presentation "Embed" feature (upload the ppt to Google Docs, then click Share...publish / embed).
For a systematic solution based also on this, I suggest taking a look at Google Docs' API
精彩评论