0
votes

Im trying to add shape over powerpoint chart in VSTO.

chart.Shapes.AddPicture(imagePath, Office.MsoTriState.msoTrue, Office.MsoTriState.msoTrue, 50, 50, 100f, 100f);

this code throws exception: "Error HRESULT E_FAIL has been returned from a call to a COM component"

I guess im doing something wrong here, kindly guide me.

1

1 Answers

0
votes

Got it working after spending much time on it. In the end it was quite simple. Successfully Added a shape over chart using this code.

       var Button = Chart.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeActionButtonCustom, float.Parse((Chart.ChartArea.Left + 5).ToString()), float.Parse((Chart.ChartArea.Top + Chart.ChartArea.Height).ToString()), 33, 34);
       Button.Name = "Sample Button";
       Button.Fill.UserPicture(@"C:\Users\ABC\Desktop\ChartIcon.PNG");