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


i use following vb.net (vsto) code add shape in ms-word,

dim app word.application = globals.thisaddin.application dim doc word.document = app.activedocument dim left single = csng(convert.todouble(app.selection.information(word.wdinformation.wdhorizontalpositionrelativetopage))) dim top single = csng(convert.todouble(app.selection.information(word.wdinformation.wdverticalpositionrelativetopage))) dim shape 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") 

what code is, adds rectangle shape @ cursor point, makes transparent (both background , line) , adds (fills) image.

this works fine in word 2007. on word 2010 , word 2013 there issue. adds rectangle shape @ cursor point , makes transparent. not fill image.

shape.fill.userpicture("c:\newfolder\app1.jpg") 

the above line of code not work in word 2010 , word 2013. other parts works fine. how modify code fill image in rectangle shape in word 2010 , 2013?

instead of shape.fill.userpicture("c:\newfolder\app1.jpg") try

    word.range range = shape1.textframe.textrange;     range.inlineshapes.addpicture(@"c:\newfolder\app1.jpg", false, true, type.missing); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -