if(fileExt ==“。doc”|| fileExt ==“。dococ”)
{
使用(WordprocessingDocument wordDoc = WordprocessingDocument.Open(document,true))
{
string docText = null;
使用(StreamReader sr = newStreamReader(wordDoc.MainDocumentPart.GetStream()))
{
docText = sr.ReadToEnd();
lbtext.Text = docText;
}
}
}
答案 0 :(得分:0)
您正在尝试使用SDK为新格式打开旧的(2003?)格式文件...
解决方案是在尝试打开文件之前将文件转换为新格式。 “WordConv.exe”是你的朋友......