Skip to content

Inserting image from a picture box in windows form application to a word document

bibhu das

Asked Dec 17, 2008, 3:43 AM EST3 answers
Share
LinkedInX
i have this windows form application where there is a picture box.i want that upon clicking save button the picture is saved into a ms word file and saved.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    private void PutImageToWord(string path, int ParagraphNumber)
            {
                Word.Application word = new Word.Application();
                word.Visible = true;
                object visible = true;
                object fileName = path;
                object optional = System.Type.Missing;
                Word.Document doc = app.Documents.Open(ref fileName,
                    ref optional,
                    ref
                optional,
                ref optional,
                ref optional,
                ref optional,
                ref optional,
                ref
                optional,
                ref optional,
                ref optional);
                Object myImageRange = word.ActiveDocument.Paragraphs[ParagraphNumber].Range;
                Object LinkToFile = false;
                Object SaveWithWord = true;
                word.ActiveDocument.InlineShapes.AddPicture(pictureBox1.ImageLocation, ref LinkToFile,
                    ref SaveWithWord,
                    ref myImageRange);

            }
    0
  • 0
    sorry for a silly doubt .i'm new to this ...what is "app "in the above post?
    0
  • Bechir Bejaoui
    0
    I'm sorry it is word and not app
    0