Friday 10 February 2012

HOW TO ADD IMAGE WORD DOC. USING C# CODE IN DOT NET




Hi everyone,
i'd like to add an image/logo to word document automatically via c# code.
i used with Microsoft.Office.Interop.Word.Document object to open the word documents,
and then i used the Shapes.AddPicture method for inserting the image into the documents.

(I didn't use the InlineShapes.AddPicture method because, these method doesn't support layers etc.)

here is my code:
object FileName = filesCollection.ToString();
object saveFileName = FileName;
object vk_read_only = false;
object vk_visibile = true;
object vk_false = false;
object vk_true = true;
object vk_dynamic = 2;
object vk_missing = System.Reflection.Missing.Value;
object LinkToFile = true;
object myRange = System.Reflection.Missing.Value;
object vk_format = Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatDocument;
object Left = 1;
object Top = 1;
object Width = 498;
object Height = 89;

oWord.Visible = true;
oWord.Activate();






No comments:

Post a Comment