问题
I have a Docx file created by adding the xml schema. I am giving you the link of the docx file .

now I want to extract-- To,From,heading,body. Currently I am using the Library DocumentFormat.OpemXml. But didnt succeed. Can any one suggest me the steps .
回答1:
This answer is late I know but after years reading this site I find myself in a position to help.
As the previous answer stated it is just as simple as opening the file as a zip and examining the contents. This approach can be limiting if you ever intend to go beyond reading some simple data out.
If you haven't already, checkout the Open XML Productivity Tool from Microsoft. It is installed as part of the openxml sdk. It makes it alot easier to find what you are looking for.
Another excellent resource is the PowerTools for OpenXML basically an open source collection of powershell cmdlets. It is the best example ive seen of coding against the open xml sdk.
-SDR
回答2:
you have to explore the DocumentFormat.OpenXml for the extraction of your data from the docx file. Or Another method is that,
First convert the extension of the docx file to .zip . After opening the zip file open the file document.xml. In this file you will find all your data . Now you just need to do is to read the xml file in c# and extract the data. You use xmlDocument class and extract The data
I think it will be useful.
来源:https://stackoverflow.com/questions/8602737/how-will-i-extract-the-data-from-the-docx-file-using-documentformat-openxml-det