Word VSTO - Das Ausfüllen einer Form funktioniert in Word 2010 und Word 2013 nicht?

Ich benutze den folgenden VB.NET (VSTO) Code, um eine Form in MS-Word hinzuzufügen,

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")

Dieser Code fügt am Cursorpunkt eine Rechteckform hinzu, macht sie transparent (Hintergrund und Linie) und fügt ein Bild hinzu (füllt es aus).

Dies funktioniert gut inWord 2007. Aber aufWord 2010 undWord 2013 Es gibt ein Problem. Es fügt die Rechteckform am Cursorpunkt hinzu und macht sie transparent. Aber es füllt das Bild nicht aus.

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

Die obige Codezeile funktioniert in Word 2010 und Word 2013 nicht. Andere Teile funktionieren einwandfrei. Wie ändere ich den Code, um das Bild in Word 2010 und 2013 in der Form eines Rechtecks auszufüllen?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage