How will i extract the data from the docx file using DocumentFormat.OpenXml -details below

南笙酒味 提交于 2019-12-19 04:57:13

问题


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

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