Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi
i have created an app that uploads files to a folder and then takes the files from that folder and convert it to images.
here is the code
C#
if (FileUpload1.HasFile)
        {
          
            string file = System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName);
            string filname = FileUpload1.PostedFile.FileName;
//UPLOADS THE FILE INTO THE FOLDER
            FileUpload1.PostedFile.SaveAs(Server.MapPath("~\\NewFolder1\\") + FileUpload1.FileName);
//TAKES THE PATH and file
            string strPath = Server.MapPath(Request.ApplicationPath) + "~/NewFolder1/" + filname;
//assign the file to ppt
 ApplicationClass pptApplication = new ApplicationClass();
            Presentation pptPresentation = pptApplication.Presentations.Open(strPath, MsoTriState.msoFalse,
            MsoTriState.msoFalse, MsoTriState.msoFalse);

            var slides = new List<string>();
            targetPath = Server.MapPath("~/NewFolder1/");
            targetPath += "\\{0}";
            for (var i = 1; i <= pptPresentation.Slides.Count; i++)
            {
             .
             .
</string>

but when i run the app it gives the follwoing error.
System.Runtime.InteropServices.COMException: PowerPoint could not open the file.
Presentation pptPresentation = pptApplication.Presentations.Open(strPath, MsoTriState.msoFalse....

please tell me where is the problem and what i need to correct
Posted
Updated 28-Oct-11 7:02am
v2
Comments
Sergey Alexandrovich Kryukov 28-Oct-11 13:05pm    
It sounds like you're trying to start PowerPoint with some file on server side. Even if you could -- why? Who would ever see this application?
--SA
I.explore.code 28-Oct-11 15:14pm    
using Interop in web-apps is not a good idea, the server may or may not allow MS Office to be installed. Unless, its your own server and you have permissions to install.

1 solution

SQL
I am having the same issue in my applictaion. Where you able to find a solution for this issue.
Thanks in advance for your help,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900