none
How to save a powerpoint file using c#? RRS feed

  • Question

  • Hi,

    I want to save a power point file using c# in an MVC3 application.

    Here is the code used by me for creating the power point application:

    Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();
    
     Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();
                //Opens a power point presentation
                Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = pptApplication.Presentations.Open(Server.MapPath("Powerpoint.ppt"));
                foreach (Microsoft.Office.Interop.PowerPoint.Slide pptSlide in pptPresentation.Slides)
                {
                    pptSlide.Shapes.AddPicture(Server.MapPath("Picture1.png"), MsoTriState.msoTrue, MsoTriState.msoTrue, 100, 100,400,350);
                }  

    In my view page, I have used a button control to open the power point presentation in the above code. Instead of opening the ppt presentation, I want to provide "save as" option or "download" option when the button is clicked. How can I achieve this?

    Thanks and regards,

    Anandaraj T

    Wednesday, May 1, 2013 5:09 AM

All replies

  • MsgBoxResult saveMessage = Interaction.MsgBox("Would you like to save?", MsgBoxStyle.YesNo, "Save Prompt"); if (saveMessage == MsgBoxResult.Yes) { pptApplication.Save(); }

    Downloading the file would depend on how your structure and such is set up, but saving the file is pretty simple.

    Alternatively, if you wanted to SaveAs, you'd make a form that could accept a text input from the user, then pass that into the pptApplication.SaveAs method.


    Wednesday, May 1, 2013 3:28 PM
  • Open, view, read powerpoint files by the using of office 2010 power point repair pptx

    Utilize http://www.repairpptx2010.pptxrepairtoolbox.com

    Sunday, September 22, 2013 1:38 PM