如何从c#中的word文件中检索单词 [英] how to retrieve words from word file in c#
本文介绍了如何从c#中的word文件中检索单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个.docx文件。假如在.docx文件中只有三个单词I AM MAYANK所以我想要3个标签中的这3个单词。
请回复
解决方案
如果可以使用Interop,请查看Document.Words属性 [ ^ ]。这会将文档中找到的所有单词列为集合。
通过这篇CP文章,这可能对你有所帮助
直接从Microsoft Word文件中读取文档文本 [ ^ ]
谢谢
< span class =code-keyword> string content = File.ReadAllText( one.docx< /跨度>);
var words = 来自字 in content.Split(WhiteSpace,StringSplitOptions.RemoveEmptyEntries)
选择字;
Hi,
I have a one .docx file.Suppose if in .docx file there are only Three words "I AM MAYANK" so i want these 3 words in 3 lables.
Please reply
解决方案
If you can use Interop, have a look at Document.Words Property [^]. That would list all the words found in a document as a collection.
go through this CP article, this may helps you
Read Document Text Directly from Microsoft Word File[^]
Thanks
string content = File.ReadAllText("one.docx"); var words = from word in content.Split(WhiteSpace, StringSplitOptions.RemoveEmptyEntries) select word;
这篇关于如何从c#中的word文件中检索单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文