3
Answers

Read doc and docx in asp.net

Tomas

Tomas

12y
11.1k
1
Hi, a have a big problem, I have to read docx but on the server is not office 2007 installed. I tryed to resolve...

using Ionic.Zip;

using (ZipFile zip = ZipFile.Read("C:\\Documents and Settings\\" + FileUpload1.FileName))
            {
                MemoryStream stream = new MemoryStream();
                //zip.Extract(@"word/document.xml", stream);
                zip.Extract(@"content.xml", stream);
                stream.Seek(0, SeekOrigin.Begin);
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(stream);
                string PlainTextContent =     xmldoc.DocumentElement.InnerText;
            }
This works good, but it gives me just plaint text.. and i need to know, where is bold, where starts new line.. so i have to know formatting.

Does anybody have an idea? Thanx

P.S. Sorry for my english. 
Answers (3)