[英]Add shape over powerpoint chart in c# VSTO
我試圖在 VSTO 中的 powerpoint 圖表上添加形狀。
chart.Shapes.AddPicture(imagePath, Office.MsoTriState.msoTrue, Office.MsoTriState.msoTrue, 50, 50, 100f, 100f);
此代碼引發異常:“錯誤 HRESULT E_FAIL 已從對 COM 組件的調用返回”
我想我在這里做錯了什么,請指導我。
花了很多時間后得到它的工作。 最后很簡單。 使用此代碼成功地在圖表上添加了一個形狀。
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");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.