Wenn ich versuche, .doc-Datei mit DocumentFormat.OpenXml DLL zu lesen, gibt es einen Fehler wie "Datei enthält beschädigte Daten."Lesen von .Doc-Datei mit DocumentFormat.OpenXml dll
Diese DLL liest DOCX-Datei richtig.
Kann DocumentFormat.OpenXml dll beim Lesen von .doc-Dateien helfen?
string path = @"D:\Data\Test.doc";
string searchKeyWord = @"java";
private bool SearchWordIsMatched(string path, string searchKeyWord)
{
try
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(path, true))
{
var text = wordDoc.MainDocumentPart.Document.InnerText;
if (text.Contains(searchKeyWord))
return true;
else
return false;
}
}
catch (Exception ex)
{
throw ex;
}
}
Dank einen Blick darauf werfen. –
Ja, ich warte auf weitere Antworten. –
Ein Jahr verging. Warte noch. :/ –