如何使用当前标签/光标位置将文本内容添加到Word文档 [英] How to add text content to a word document using the current tab/cursor location

查看:332
本文介绍了如何使用当前标签/光标位置将文本内容添加到Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试使用命令

添加内容到ms文件。

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

现在我将手动更改打开的文档中的光标位置,



$ b

$ word-> Selection-> Typetext(要添加到当前光标位置的内容); b

上面的代码会将内容添加到Doc文件的开头,但是如何在游标所在的位置添加。

解决方案

我有一个解决方案。无论我在Active Word文档中保存我的光标,我都可以导出文本。


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.

解决方案

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

这篇关于如何使用当前标签/光标位置将文本内容添加到Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆