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;
}
}
}
Asked
Active
Viewed 696 times
0

user3670985
- 1
- 1
1 Answers
0
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...

Martin Milan
- 6,346
- 2
- 32
- 44