0
votes

if (fileExt == ".doc" || fileExt == ".docx") { using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document,true)) { string docText = null; using (StreamReader sr = newStreamReader(wordDoc.MainDocumentPart.GetStream())) { docText = sr.ReadToEnd(); lbtext.Text = docText; }
}
}

1

1 Answers

0
votes

You're trying to open an old (2003?) format file using the SDK for the new format...

The solution is to convert the file into the new format before trying to open it. "WordConv.exe" is your friend...