3

Onenote Interop を使用して画像からテキストを抽出する必要がある簡単なプログラムを実行する必要がありますか? 私のコンセプトに適したドキュメントを教えてください。

4

1 に答える 1

3

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>

この XML は、OMSPY というプログラムを使用して表示できます (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

于 2011-09-10T13:10:00.533 に答える