vb.net - How to insert Image object as picture in Word document -


so have function generating , returning image (a .bmp format). want put word document. looked @ inlineshapes.addpicture takes string argument, requires me save picture physically , give path of picture parameter addpicture, don't want. want generate pic , directly store it, whereas need method takes image parameter.

p.s. creation of word document, tables, deciding cell put pic , stuff done, need insertion of picture.

and code generating picture, can see have object, don't store anywhere physically. in c#, want operate word document, writing in vb.net.

bitmap picture = new bitmap(100, 100);          // generates qrcode image , returns         public image generateqrcodeimage(string textvalue)         {             qrencoder encoder = new qrencoder(errorcorrectionlevel.m);             qrcode qrcode;             encoder.tryencode(textvalue, out qrcode);              using (graphics graph = graphics.fromimage(picture))             {                 new graphicsrenderer(new fixedcodesize(100, quietzonemodules.two)).draw(graph, qrcode.matrix);             }              return picture;         } 

if have set word document creation , opening, , according function you've provided, suppose thing left be:

    dim rng word.range = odoc.range(int1, int2)      dim img image = qrgen.generateqrcodeimage("desiredinfotoencloseinqrcode")     clipboard.setimage(img)     rng.paste() 

where qrgen of course object of class implements generateqrcodeimage() function. , have put code somewhere want arrange in word document (a table/cell/etc.)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -