Adding picture to powerpoint slides via C# throws The remote procedure call failed. (Exception from HRESULT: 0x800706BE) RRS feed

  • Question

  • Hie guys,

    I have a block of code here:

        System.Net.WebClient wc = new System.Net.WebClient();
        byte[] data = wc.DownloadData(xmlTempNode.Attributes["imageurl"].Value.ToString());
        MemoryStream ms = new MemoryStream(data);
        System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
        string strImagePath = pptdirectoryPath + "\\" + currentSlide + "_" + shape.Id + ".png";
        tempSlide.Shapes.AddPicture(strImagePath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, shape.Left, shape.Top, Convert.ToInt32(xmlTempNode.Attributes["imgwidth"].Value), Convert.ToInt32(xmlTempNode.Attributes["imgheight"].Value));

    `tempSlide.Shapes.AddPicture` works fine for smaller images(fails sometimes for smaller images too),and it fails when resolution is higher(here fail means response is not received for infinite time and throws exception when page is refreshed).

    **Exception Message:** The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
       at Microsoft.Office.Interop.PowerPoint.Shapes.AddPicture(String FileName, MsoTriState LinkToFile, MsoTriState SaveWithDocument, Single Left, Single Top, Single Width, Single Height).

    System type:64 bit

    Any help would be appreciated.

    • Moved by CoolDadTx Wednesday, June 26, 2013 3:04 PM Office related
    Wednesday, June 26, 2013 12:58 PM

All replies

  • Hi Milind,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards,

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 28, 2013 7:11 AM
  • Hello Milind,

    What kind of application is this? Is it a web application?


    Tuesday, July 2, 2013 3:12 PM