Powerpoint.dll (HRESULT exception: 0x80010001 (RPC_E_CALL_REJECTED))

Asked

Viewed 264 times

1

Error description:

Component COM Class Factory Recovery Failure with CLSID {91493441-5A91-11CF-8700-00AA0060263B} due to the following error: 80010001 The call was rejected by the call. (Exception of HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).

I have tried the solution in several links:

https://stackoverflow.com/questions/20638978/call-was-rejected-by-callee-exception-from-hresult-0x80010001-rpc-e-call-rej

https://msdn.microsoft.com/pt-br/library/ms228772(v=vs.110). aspx

Basically what I do in the code is create a Powerpoint via MVC and return the file to download.

        MessageFilter.Register();
        Application powerPointApplication = new Application();
        //powerPointApplication.Visible = MsoTriState.msoFalse;

        var pptPresentation = powerPointApplication.Presentations.Add(MsoTriState.msoFalse);
        Microsoft.Office.Interop.PowerPoint.CustomLayout customLayout =
            pptPresentation.SlideMaster.CustomLayouts[Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutText];

        //Step5.Insert a slide by calling the Add method on the Presentation.Slides collection, and add some texts to the slide.

        var index = 1;

        var oSlides = pptPresentation.Slides;

        if (model.Configuration.Ratio == "4:3")
        {
            pptPresentation.PageSetup.SlideSize = PpSlideSizeType.ppSlideSizeOnScreen;
        }

        foreach (var slide in model.Slides)
        {
            var oSlide = oSlides.AddSlide(index, customLayout);

            oSlide.FollowMasterBackground = MsoTriState.msoFalse;
            //oSlide.Background.Fill.BackColor.RGB = Convert.ToInt32(ExtractHex(model.Configuration.Background), 16);
            oSlide.Background.Fill.BackColor.RGB = ColorTranslator.ToOle(HexToColor(model.Configuration.Background));

            //content
            var oShape = oSlide.Shapes[2];

            //oShape.LockAspectRatio = MsoTriState.msoTriStateToggle;

            var oTxtFrame = oShape.TextFrame;
            var oTxtRange = oTxtFrame.TextRange;
            oTxtRange.Text = FormatText(slide);
            //oTxtRange.Font.Size = model.Configuration.FontSize;

            oTxtRange.Font.Color.RGB = ColorTranslator.ToOle(HexToColor(model.Configuration.Forecolor));

            oTxtRange.Font.Size = GetFontSize(slide);

            if (model.Configuration.Font != null)
            {
                oTxtRange.Font.Name = model.Configuration.Font;
            }
            //oTxtRange.Font.Bold = MsoTriState.msoTrue;
            oShape.TextEffect.Alignment = MsoTextEffectAlignment.msoTextEffectAlignmentCentered;


            oTxtFrame.HorizontalAnchor = MsoHorizontalAnchor.msoAnchorCenter;
            //oTxtFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;

            var format = oTxtRange.Paragraphs().ParagraphFormat;
            format.Bullet.Type = PpBulletType.ppBulletNone;

            //format.Alignment = PpParagraphAlignment.ppAlignCenter;

            index++;
        }

        //Step6.Save the presentation as a pptx file and close it.
        model.Name = "presentation.ppt";
        string fileFullPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + model.Name;

        pptPresentation.SaveAs(fileFullPath, PpSaveAsFileType.ppSaveAsOpenXMLPresentation, MsoTriState.msoTriStateMixed);
        pptPresentation.Close();

        powerPointApplication.Quit();

        MessageFilter.Revoke();

        return File(fileFullPath, "application/vnd.ms-powerpoint", model.Name);
  • I believe you will have to list in your question the links you have already tried. So it will help in a more direct answer (without repeating what you have already tried).

  • Adding your code will help in understanding the question, which would make it easier to get an answer.

  • Thanks for the tips. I already packed in the question.

  • Hello, looking at the related pages, I could not reach a solution, I use in my system Delphi the generated reports, Report Manager, in some older reports, where when exporting occurs the same error, would have some solution to this problem?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.