我试图通过单击VSTO PP AddIn中的TaskPanel按钮来添加图片,该代码在WinForms中有效。
现在,我尝试使用Xaml主机集TaskPanel实现此功能,但是它无法正常工作(相同的代码)。
它不会编译,但不会显示错误:
public void AddImageToSlideEvent(object sender, EventArgs e)
{
//Cast sender as button for tag attribute
Button button = sender as Button;
Powerpoint.Application presentation = Globals.ThisAddIn.Application;
//save current slide in "currentSlide"
var currentSlide = Globals.ThisAddIn.Application.ActiveWindow.View.Slide;
//TODO: Add Picture does not work
Powerpoint.Shape shape = currentSlide.Shapes.AddPicture(button.Tag, true, true, 250, 250);
}
谁可以在这里帮助您?
很多东西
myDocument.Shapes.AddPicture FileName:="c:\microsoft office\" & _
"clipart\music.bmp", LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, _
Left:=100, Top:=100, Width:=70, Height:=70
但是感谢您的帮助!