Word VSTO - 填充形状在 Word 2010 和 Word 2013 中不起作用?

Word VSTO - Filling a shape does not work in Word 2010 and Word 2013?

我使用以下 VB.NET (VSTO) 代码在 MS-Word 中添加形状,

Dim app As Word.Application = Globals.ThisAddIn.Application
Dim doc As Word.Document = app.ActiveDocument
Dim left As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdHorizontalPositionRelativeToPage)))
Dim top As Single = CSng(Convert.ToDouble(app.Selection.Information(Word.WdInformation.wdVerticalPositionRelativeToPage)))
Dim shape As Word.Shape = doc.Shapes.AddShape(1, left, top, 225.1F, 224.5F)

shape.Fill.BackColor.RGB = ColorTranslator.ToOle(Color.Transparent)
shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
shape.Fill.Transparency = 0.0F
shape.Line.Transparency = 0.0F
shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
shape.Fill.UserPicture("C:\Newfolder\App1.jpg")

这段代码所做的是,它在光标点添加一个矩形,使其透明(背景和线条)并添加(填充)图像。

这在 Word 2007 中工作正常。但是在 Word 2010Word 2013 上存在问题。它在光标点处添加矩形形状并使其透明。但它不会填充图像。

shape.Fill.UserPicture("C:\Newfolder\App1.jpg")

上述代码行在Word 2010和Word 2013中不起作用,其他部分正常。如何修改Word 2010和Word 2013中矩形填充图片的代码?

而不是shape.Fill.UserPicture("C:\Newfolder\App1.jpg")尝试

    Word.Range range = shape1.TextFrame.TextRange;
    range.InlineShapes.AddPicture(@"C:\Newfolder\App1.jpg", false, true, Type.Missing);