我需要做一个简单的程序,需要使用 Onenote Interop 从图像中提取文本?有人可以建议我一份适合我的概念的文件吗?
OneNote 的 OCR 识别的文本存储在 OneNote 中 XML 文件结构的 one:OCRText 元素中。例如
<one:Page ...>
...
<one:Image ...>
...
<one:OCRData lang="en-US">
<one:OCRText><![CDATA[This is some sampletext]]></one:OCRText>
</one:OCRData>
</one:Image>
</one:Page>
您可以使用名为 OMSPY 的程序查看此 XML(它向您显示 OneNote 页面背后的 XML)-http://blogs.msdn.com/b/johnguin/archive/2011/07/28/onenote-spy-omspy-for-onenote-2010.aspx
要提取文本,您将使用 OneNote COM 互操作(正如您所指出的)。例如
//Instantialize OneNote
ApplicationClass onApp = new ApplicationClass();
//Get the XMl from the selected page
string xml = "";
onApp.GetPageContent("put the page id here", out xml);
//Put it into an XML document (from System.XML.Linq)
XDocument xDoc = XDocument.Parse(xml);
//OneNote's Namespace - for OneNote 2010
XNamespace one = "http://schemas.microsoft.com/office/onenote/2010/onenote";
//Get all the OCRText from the page
string[] OCRText = xDoc.Descendants(one + "OCRText").Select(x => x.Value).ToArray();
有关详细信息,请参阅 MSDN 上的“应用程序接口”文档 -http://msdn.microsoft.com/en-us/library/gg649853.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)