Word._Document.Words属性需要帮助 [英] help needed on Word._Document.Words property

查看:65
本文介绍了Word._Document.Words属性需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用Office XP PIA来阅读word文档。我能够阅读整个内容。问题是我想在文档中获取特定单词而不是整个内容。

_Document.Words属性是否有用于从文档中逐字检索???如果有可能,如何使用它???


谢谢

Nelluru

Hi,
I am using Office XP PIA''s to read a word document. I am able to read the whole content. The problem is that i want to get a particular word in the document instead of the whole content.
Will the _Document.Words property is useful to retrieve word by word form the document??? If it is possible, How to use it???

thanks
Nelluru

推荐答案




我正在使用Office XP PIA来阅读word文档。我能够阅读整个内容。问题是我想在文档中获取特定单词而不是整个内容。

_Document.Words属性是否有用于从文档中逐字检索???如果有可能,如何使用它???


感谢

Nelluru
Hi,
I am using Office XP PIA''s to read a word document. I am able to read the whole content. The problem is that i want to get a particular word in the document instead of the whole content.
Will the _Document.Words property is useful to retrieve word by word form the document??? If it is possible, How to use it???

thanks
Nelluru



在.NET中进行Word自动化很难,但是,是的,你可以使用他的Words集合。此示例显示文档中的单词6:

It''s hard to do Word automation in .NET, but, yes, you can use he Words collection. This example shows word 6 in the doc:

展开 | 选择 | Wrap | 行号


hi,

请帮助我。 。

我收到此错误:
''Microsoft.Office.Interop.Word.Words''不包含''Item''的定义。


代码是:

Microsoft.Office.Interop.Word.Words w = wdDoc.Words;

Microsoft.Office.Interop.Word.Range r = w.Item(2);



我在项目中包含了Microsoft.Office.Interop.Word dll。我正在使用Microsoft Visual C#2005 Express Edition。


原因是什么?

有什么我想念的吗?


预付款

Nelluru

Please help me..
I am getting this error:
''Microsoft.Office.Interop.Word.Words'' does not contain a definition for ''Item''.

Code is:

Microsoft.Office.Interop.Word.Words w = wdDoc.Words;
Microsoft.Office.Interop.Word.Range r = w.Item(2);


I have included Microsoft.Office.Interop.Word dll in my project. And I am using Microsoft Visual C# 2005 Express Edition.

What would be the reason??
Is there anything I am missing???

thanks in Advance
Nelluru





我正在使用Office XP PIA来阅读word文档。我能够阅读整个内容。问题是我想在文档中获取特定单词而不是整个内容。

_Document.Words属性是否有用于从文档中逐字检索???如果有可能,如何使用它???


感谢

Nelluru
Hi,
I am using Office XP PIA''s to read a word document. I am able to read the whole content. The problem is that i want to get a particular word in the document instead of the whole content.
Will the _Document.Words property is useful to retrieve word by word form the document??? If it is possible, How to use it???

thanks
Nelluru



只是提醒一句。如果您习惯使用Word宏,那么您将倾向于将Word对象放在一起,如wdDoc.Words.Item(6),而不是单独处理每个对象。这并不总是适用于C#。 VBA保留了我们的许多细节。将东西推入Variants。 C#不会这样做,但是如果单步执行代码,通常可以看到需要创建的中间对象。我没有用Word做过这个,但是我用Excel完成了它并且非常痛苦

Just a word of caution. If you are used to working with Word macros, then you will have a tendency to put Word objects together like wdDoc.Words.Item(6) instead of dealing with each object separately. This will not always work with C#. VBA kept a lot of details from us & pushed stuff into Variants. C# will not do this, but if you single step through your code, you can usually see what intermediate objects you need to create. I haven''t done this with Word, but I have done it with Excel and it was very painful


这篇关于Word._Document.Words属性需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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