Z
Z
Zulkund2017-03-07 15:49:41
C++ / C#
Zulkund, 2017-03-07 15:49:41

How to work with Word files from C#?

Good afternoon, tell me how to insert a picture into a Word file from Visual Studio C#? The image is stored in a BitmapImage.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
leremin, 2017-03-07
@Zulkund

If through interop, then something like this

Word.Application application = new Word.Application();
Object missing = Type.Missing;
application.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Clipboard.SetImage(pictureBox1.Image);
application.ActiveDocument.Paragraphs[1].Range.Paste();
application.Visible = true;

In general, google "word interop insert image" or "openxml sdk insert image". The topic is quite broad.

V
VMesser, 2017-03-07
@VMesser

I don’t know anything about bibles, they probably already exist if it’s .Net, but I’ll definitely advise you to rustle VBA, because all the code in the first answer is what it is, all communication with the office is based on it.

B
bullock, 2017-10-17
@bullock

Inserting an image into a word document (Open XML SDK)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question