Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3677758
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:15:37+00:00 2026-05-19T03:15:37+00:00

I have application which can export slides to PowerPoint. I’m using Microsoft.Office.Interop.PowerPoint.dll . This

  • 0

I have application which can export slides to PowerPoint. I’m using Microsoft.Office.Interop.PowerPoint.dll . This is the 11th version of assembly. I have ran application today and it seems that application throws an exception (Exception from HRESULT: 0x80070057 (E_INVALIDARG)). It only throws this exception when there is powerpoint application opened in system before i click export button. I’m adding a custom property to CustomDocumentProperties of Powerpoint presentation in order to identify which presentation was created by the application. This is the first time when I saw this exception. I have Windows 7 Ultimate x64 sytem with visual studio 2008 and 2010 and of course office 2007.

The part of code that causes the exception:

oDocAuthorProp = typeDocBuiltInProps.InvokeMember("Item",
                                                   BindingFlags.Default |
                                                   BindingFlags.GetProperty,
                                                   null, oDocBuiltInProps,
                                                   new object[] { strIndex });

What’s wrong?
I followed this article by Microsoft: http://support.microsoft.com/kb/303296

For over one year the Application has been working without any issue. What goes wrong? After 10 hours spent on searching the Internet for the answer I’m giving up.

here is the code of the Export2Powerpoint method:

public static void Export(List<ChartObject> chartObjects)

{
    Application ppApp = new Application();


    foreach (ChartObject chartObject in chartObjects)
    {
        chartObject.Chart.BorderLineStyle = ChartDashStyle.NotSet;
    }

    Presentation ppPress = null;

    int i;
    object oDocBuiltInProps;

    string strValue = string.Empty;

    if(ppApp.Presentations.Count == 0)
    {
        ppPress = AddPresentation(ppApp, ppPress);
    }
    else
    {
        i = 0;


        object oDocAuthorProp = null;

        foreach (Presentation presentation in ppApp.Presentations)
        {
            oDocBuiltInProps = presentation.CustomDocumentProperties;
            Type typeDocBuiltInProps = oDocBuiltInProps.GetType();

            string strIndex = "Browser";


            try{


                oDocAuthorProp = typeDocBuiltInProps.InvokeMember("Item",
                                           BindingFlags.Default |
                                           BindingFlags.GetProperty,
                                           null, oDocBuiltInProps,
                                           new object[] { strIndex }); ======>> here is the line that generates the exception
            }
            catch(Exception e)
            {
                //ErrorHandling.LogErrorToFile(e.Message, e.StackTrace);
            }
            if (oDocAuthorProp != null)
            {
                Type typeDocAuthorProp = oDocAuthorProp.GetType();
                strValue = typeDocAuthorProp.InvokeMember("Value",
                                                          BindingFlags.Default |
                                                          BindingFlags.GetProperty,
                                                          null, oDocAuthorProp,
                                                          new object[] {}).ToString();
            }

            i++;

            if(strValue == "true")
            {
                break;
            }                       
        }

        if (strValue != string.Empty)
        {
            ppPress = ppApp.Presentations[i];
        }
        else
        {
            ppPress = AddPresentation(ppApp, ppPress);
        }
    }

    i = ppPress.Slides.Count + 1;

    int j = 0;

    chartObjects.Reverse();
    chartObjects.ForEach(chartObject =>
    {
         string directory = Path.Combine(System.Windows.Forms.Application.StartupPath, (i) + ".png");
         PowerPoint.Slide actSlide = ppPress.Slides.Add(i, PpSlideLayout.ppLayoutBlank);
         actSlide = ppPress.Slides[i];
         Size size = chartObject.Chart.Size;

         chartObject.Chart.ChartAreas[0].AxisX.LabelsAutoFitMinFontSize = 14;

         chartObject.Chart.Size = new Size(RunTime.Configuration.ImageXSize,RunTime.Configuration.ImageYSize);

         chartObject.Chart.SaveAsImage(directory, ChartImageFormat.Png);
         chartObject.Chart.Size = size;
         Image image = Image.FromFile(directory);
         actSlide.Shapes.AddPicture(directory, MsoTriState.msoFalse,
                  MsoTriState.msoTrue, 0, 0, (int)ppPress.SlideMaster.Width, (int)ppPress.SlideMaster.Height);

         image.Dispose();
         File.Delete(directory);
         j++;
    });

    chartObjects.Reverse();

    ppApp.Visible = MsoTriState.msoTrue;

    foreach (ChartObject chartObject in chartObjects)
    {
        chartObject.Chart.BorderLineStyle = ChartDashStyle.Solid;
    }
}

EDIT:
This kind of exception is being thrown only when there is opened at least one powerpoint window and presentation in that window hasn’t been saved to disk yet. When there is opened at least one powerpoint windows with presentation already saved to disk, the application is working fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:15:38+00:00Added an answer on May 19, 2026 at 3:15 am

    I experienced what I suspect may be a similar problem (At the time, inexplicable exceptions on code that previously worked, but we did track it down) when embedded fonts were used by PowerPoint. It turned out to be an unanswered, invisible dialog box blocking the application, which the interop library turned into an exception. In essence, our experience was that there are many features of the PowerPoint application which aren’t available to the interop classes, and if they’re reached in normal operation then the interop code either hangs or breaks (usually breaks). So, in our case, there was no interop flag to allow the use of embedded fonts (in the PowerPoint application, when a file has embedded fonts, it forces a prompt (do you want to open this in readonly mode, or not at all?)) which must be answered, and because there’s no ability in the interop libraries to specify your choice, the interop call throws an exception. So, my guess is that there’s something going on here where the interop library cannot answer a “blocking” question posed by the PowerPoint application.

    Of course, the most common reasons that we ran into this problem were all caused by Windows Update providing updates for Office which updates PowerPoint’s security defaults. You might want to check that first.

    If you were to perform that same action (change that field to “browser”, as I think you appear to be doing) in a normal PowerPoint application window, on a presentation that hadn’t been saved, would it present you with a dialog?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which extracts data from an XML file using XPath. If
I have a RAM of 2 GB. We have a application which performs Export/Import
I have an application which really should be installed, but does work fine when
We have an application which needs to use Direct3D. Specifically, it needs at least
I have an application which behaves as a slideshow for all pictures in a
I have an application which is a portal application and I want to allow
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I have an application which get copied and run on client machines. The program
I have an application which has to live as a service, I create an
I have one application which uses the standard .NET forms authentication cookie, now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.