Search code examples
c#phpvb.netcomms-word

How to add text content to a word document using the current tab/cursor location


Hi I am trying to add content to a ms word file which is opened using the command

$word = new COM("word.application") or die("Unable to instanciate Word"); 
$input ="D:\\testword.docx"; 
$word->Documents->Open($input); 

Now I will manually change the cursor position in the opened document and I want to add some content to that position.

$word->Selection->Typetext("The content to be added into current cursor position");

Above code will add the content into the start of the Doc file but how to Add it wherever the cursor is located.


Solution

  • I got a solution. Wherever I keep my Cursor in Active Word document there I can Export the Text.