How can i read .docx file? [closed]

泪湿孤枕 提交于 2019-11-27 01:53:27

The easiest way is probably to use the Open XML SDK 2.0

Get Code Snippets for Visual Studio 2008 for some examples

And I would highly recommend downloading the Open XML SDK productivity tool which will help you understand how the Open XML files are structured, and can even help you generate source code to use with the SDK based on the structure of your documents. You can download the tool from the same page as the SDK. It's 100MB, but it's worth the download.

You can simply use Docx library, it is very good and easy to use.

For samples guiding how to use and many examples and videos, check their GitHub page. For download, you could download from here

Bertvan

You can read Microsoft Office files through Interop, and Office >2007 files through Open XML as well:

Yes, I know this is a very old post, but this information might help others who are searching the forums.

Use this library from Sourceforge. Add a reference to that library, and then:

Code7248.word_reader.TextExtractor extractor = new TextExtractor(filePath);

string contents = extractor.ExtractText();

Office 2007 and above follow OpenXML format. you need Packaging API to open and read document parts

http://msdn.microsoft.com/en-us/library/system.io.packaging.aspx

http://openxmldeveloper.org

docx files are in fact archives.

You can unzip them into their composite XML files and read through the relevant XML file (file.docx\word\document.xml)) and pull out the email addresses.

This library will help you to unzip the archive: .Net Zip Library

There is free way to read doc & docx file, It could help you.

Document doc = new Document();
doc.LoadFromFile("yourfile.docx");

http://freeword.codeplex.com/

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