user1006544
user1006544

Reputation: 1524

How can we read .docx file using C#?

I want to read a docx File in c#. the docx file when converted to .zip generate the xml of our file. I want to read that xml file . I need all the data from the doc with ther font name (bold italic setting), color from the file. How can we do this?

Upvotes: 1

Views: 3613

Answers (4)

Richard Szalay
Richard Szalay

Reputation: 84804

Low level answer: DOCX files are OPC (Open Packaging Conventions) format (zip files with a manifest) and can be opened with the classes available in the System.IO.Packaging namespace.

High level answer: DocX is an opensource framework that supports manipulating DOCX files using higher level constructs.

Upvotes: 4

Adam
Adam

Reputation: 16199

You would use the Microsoft Office 12.0 Object Library

Upvotes: 1

Raj
Raj

Reputation: 1770

If you're able to read the file as XML then may be you could apply some XPATH queries to get the info you need.

Upvotes: 0

Lucero
Lucero

Reputation: 60276

The format of DOCX is well documented. To read the packages, you can use the classes from the System.IO.Packaging namespace.

Upvotes: 3

Related Questions