如何从Ms Word文本框中读取内容 [英] How Do I Read Content From A Ms Word Text Box

查看:107
本文介绍了如何从Ms Word文本框中读取内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



正在寻找一种方法来阅读word文档文本框中的文本。我最好的是带下划线的红色代码:



 doc.Shape(





这是令人尴尬的,但这是我经过几天的研究后得到的。请帮助我,因为我现在完全陷入困境。

解决方案

<激活文档后,blockquote>

  //    

foreach (Microsoft.Office.Interop.Word.Range newRange in doc.StoryRanges)
{
// 选择要处理的对象
nrwRange.Select ();
// 在Word文档的文本框中选择文本。
string textInTextBoxFromMSWordDocument = newRange.Text;
// 点ardon奇怪的变量名称。只是尽量简洁和描述。
}


Hi all.

I am looking for a way to read the text inside a word document text box. The best i have is a red underlined code:

doc.Shape(



This is embarrassing but it is all i got after days of research. Please assist me as i am now totally stuck.

解决方案

//after activating the document

foreach(Microsoft.Office.Interop.Word.Range newRange in doc.StoryRanges)
{
    //Pick the object you want to process
    nrwRange.Select();
    //Select the text in the Text Box in Word document.
    string textInTextBoxFromMSWordDocument = newRange.Text;
    //pardon the weird variable name. Just trying to be brief and descriptive as possible.
}


这篇关于如何从Ms Word文本框中读取内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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