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

本秂侑毒 提交于 2019-12-12 04:59:58

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/32242912/how-to-add-text-content-to-a-word-document-using-the-current-tab-cursor-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!