我想在JavaScript中使用正则表达式来验证十进制数.
它应该只允许最多两位小数.例如,它应该允许10.89但不允许10.899.
它也应该只允许一个句点(.).例如,它应该允许10.89但不允许10.8.9.
当我尝试使用DocumentFormat.OpenXml dll读取.doc文件时,它给出的错误为"文件包含损坏的数据".
这个DLL正在正确读取.docx文件.
DocumentFormat.OpenXml dll可以帮助读取.doc文件吗?
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;
}
}
Run Code Online (Sandbox Code Playgroud)