Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Programmatically access powerpoint file using c# without using office dll

Programmatically access powerpoint file using c# without using office dll

Scheduled Pinned Locked Moved C#
csharpasp-netcomdesignsysadmin
9 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sarah_chandran
    wrote on last edited by
    #1

    Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.

    using Microsoft.Office.Core;
    using Microsoft.Office.Interop.PowerPoint;
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    var app = new Microsoft.Office.Interop.PowerPoint.Application();
    var pres = app.Presentations;
    var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
    file.Export(@"C:\testNew.png", "PNG");
    }
    }

    I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah

    P M N I 4 Replies Last reply
    0
    • S sarah_chandran

      Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.

      using Microsoft.Office.Core;
      using Microsoft.Office.Interop.PowerPoint;
      public partial class _Default : System.Web.UI.Page
      {
      protected void Page_Load(object sender, EventArgs e)
      {
      var app = new Microsoft.Office.Interop.PowerPoint.Application();
      var pres = app.Presentations;
      var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
      file.Export(@"C:\testNew.png", "PNG");
      }
      }

      I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Unfortunately Sarah, without using Office you are either going to have to use a specialist 3rd party component, or write one of your own. For the ROI, I'd suggest you should look at Aspose components.

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      B 1 Reply Last reply
      0
      • S sarah_chandran

        Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.

        using Microsoft.Office.Core;
        using Microsoft.Office.Interop.PowerPoint;
        public partial class _Default : System.Web.UI.Page
        {
        protected void Page_Load(object sender, EventArgs e)
        {
        var app = new Microsoft.Office.Interop.PowerPoint.Application();
        var pres = app.Presentations;
        var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
        file.Export(@"C:\testNew.png", "PNG");
        }
        }

        I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah

        M Offline
        M Offline
        Matt Meyer
        wrote on last edited by
        #3

        One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.

        L P 2 Replies Last reply
        0
        • S sarah_chandran

          Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.

          using Microsoft.Office.Core;
          using Microsoft.Office.Interop.PowerPoint;
          public partial class _Default : System.Web.UI.Page
          {
          protected void Page_Load(object sender, EventArgs e)
          {
          var app = new Microsoft.Office.Interop.PowerPoint.Application();
          var pres = app.Presentations;
          var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
          file.Export(@"C:\testNew.png", "PNG");
          }
          }

          I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Microsoft uses OpenXML format (or so they say) so don't technically need Office to open/read the file. https://openxmldeveloper.org/[^]


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • M Matt Meyer

            One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I believe this will copy only the Interop files. The actual COM DLLs that get the job done should still be identified, copied and registered separately.

            M 1 Reply Last reply
            0
            • L Lost User

              I believe this will copy only the Interop files. The actual COM DLLs that get the job done should still be identified, copied and registered separately.

              M Offline
              M Offline
              Matt Meyer
              wrote on last edited by
              #6

              That's why I wasn't sure if it would all play well together, or just bring those.

              1 Reply Last reply
              0
              • M Matt Meyer

                One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                It won't work for Office - all that will do is copy the PIA across. As these are talking to honking great COM objects, these will need to be installed as well.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                1 Reply Last reply
                0
                • S sarah_chandran

                  Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.

                  using Microsoft.Office.Core;
                  using Microsoft.Office.Interop.PowerPoint;
                  public partial class _Default : System.Web.UI.Page
                  {
                  protected void Page_Load(object sender, EventArgs e)
                  {
                  var app = new Microsoft.Office.Interop.PowerPoint.Application();
                  var pres = app.Presentations;
                  var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
                  file.Export(@"C:\testNew.png", "PNG");
                  }
                  }

                  I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah

                  I Offline
                  I Offline
                  Ian Shlasko
                  wrote on last edited by
                  #8

                  As the others have said, there's no easy way to do this yet (At least none that I've heard of)... You MIGHT be able to hack something together yourself, though. The Java POI library is, I believe, capable of converting PPTs to images (But not PPTX), so you could take their code, build your own translator from the PPTX format, and tie them together... It would require interfacing with Java as the NPOI project hasn't, to my knowledge, incorporated PowerPoint functionality yet. If that's too difficult, you might just have to bite the bullet and install Office on the server.

                  Proud to have finally moved to the A-Ark. Which one are you in?
                  Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Unfortunately Sarah, without using Office you are either going to have to use a specialist 3rd party component, or write one of your own. For the ROI, I'd suggest you should look at Aspose components.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                    B Offline
                    B Offline
                    BobJanova
                    wrote on last edited by
                    #9

                    We use Aspose stuff on the project I'm on at the minute. I'm not sure what the license fee is (the client had already bought it) but it seems to be quite effective.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups