Question Insert Image at user selected cursor or current position

mmazeemahmad

New member
Joined
May 10, 2020
Messages
4
Programming Experience
3-5
Dear All,



I am using the following code where i am trying to insert an image at current position or where event the user cursor is currently there but always it insert it on top of the word document can anyone please guide the missing bit:



Microsoft.Office.Interop.Word._Application oWord;
object oMissing = Type.Missing;
oWord = new Microsoft.Office.Interop.Word.Application();
oWord.Visible = false;
oWord.Documents.Open(rtffile);




string arrowpath = SMBytepath + "\\Arrow Final.png";
_ = oWord.Selection.InlineShapes.AddPicture(arrowpath).ConvertToShape().WrapFormat.AllowOverlap;
oWord.Selection.Select();

oWord.ActiveDocument.Save();
oWord.Quit();
 
First of all this doesn't look like a C# question. It's a Word Object Model question and would the same type of issue regardless of using C#, VB.NET, VBA, or C++.

Anyway, are you trying to insert at the cursor position or the caret position? Although on text consoles cursor and caret are treated as one the same, in the Windows GUI world, the cursor position is where the mouse is pointing, while the caret is where the I beam is blinking.
 
First of all this doesn't look like a C# question. It's a Word Object Model question and would the same type of issue regardless of using C#, VB.NET, VBA, or C++.

Anyway, are you trying to insert at the cursor position or the caret position? Although on text consoles cursor and caret are treated as one the same, in the Windows GUI world, the cursor position is where the mouse is pointing, while the caret is where the I beam is blinking.
Thanks for your response dear, i am looking to insert at caret position.
 
Back
Top Bottom