Tomas

Tomas

  • NA
  • 4
  • 0

Read doc and docx in asp.net

May 25 2009 3:20 AM
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)