- using Microsoft.Office.Interop.PowerPoint;
- using Microsoft.Office.Core;
- using System.IO;
- try
- {
- FileInfo objfile = new FileInfo(FileUpload1.PostedFile.FileName);
- if (objfile.Extension.Equals(".ppt"))
- {
- ApplicationClass pptApplication = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
- Presentation pptPresentation = pptApplication.Presentations.Open(objfile.FullName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
- pptPresentation.Export(objfile.FullName, "jpg", Int32.Parse(pptPresentation.SlideMaster.Width.ToString()), Int32.Parse(pptPresentation.SlideMaster.Height.ToString()));
- }
- else
- {
- Response.Write("Please choose PowerPoint files only");
- }
- }
- catch (Exception ex)
- { }
Loading
Join the conversation! Your thoughts help the community grow.