【问题标题】:OneNote-API opens OneNote-Application on OnenotePage.Save()OneNote-API 在 OnenotePage.Save() 上打开 OneNote-Application
【发布时间】:2015-10-23 01:46:07
【问题描述】:

我正在尝试使用 onenote-API 从图像中提取 ocr。 所以一切正常,如预期的那样。但是当我从类 OnenotePage 调用方法 save 时,OneNote-Application 被打开了。

到目前为止我的代码:

private const int PollInterval = 250;
private const int PollAttempts = 2;

public string RecognizeIntern(Image image)
{
    var app = new Application();
    var page = new OnenotePage(app);

    page.Reload();
    page.Clear();
    page.AddImage(image);
    page.Save()
    int total = 0;
    do
    {
        Thread.Sleep(PollInterval);
        page.Reload();
        string result = page.ReadOcrText();
        if (result != null)
            return result;
    } while (total++ < PollAttempts);

    return null;
}

我的 OnenotePage“保存”方法:

public void Save()
{
    app.GetPageContent(this._pageId, out strXml, PageInfo.piBinaryData);
    document = XDocument.Parse(strXml);
    var xml = document.ToString();
    app.UpdatePageContent(xml);

    app.NavigateTo(this._pageId);
}

知道如何在不打开 OneNote-Application 的情况下保存吗?

【问题讨论】:

    标签: c# onenote onenote-api


    【解决方案1】:

    不要调用 app.NavigateTo(this._pageId) :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多