2017-05-05 63 views
0

有一個用於在OneNote中獲取墨跡筆劃對象的API。根據示例/ documentation,您可以運行獲取InkStroke對象的代碼。我的理解是,熒光筆筆畫是OneNote對象模型中的FloatingInk。是否有可能獲得關於中風本身的信息?例如:OneNote InkStroke/FloatingInk API

if(inkObject.getType() == "Highlighter") { 
    var width = inkObject.getStroke().width; 
    var height = inkObject.getStroke().height; 
} 

該文檔顯示了下面的示例,但它似乎只是使「id」屬性可用。

OneNote.run(function(context) { 

    // Gets the active page. 
    var page = context.application.getActivePage(); 
    var contents = page.contents; 

    // Load page contents and their types. 
    page.load('contents/type'); 
    return context.sync() 
     .then(function(){ 

      // Load every ink content. 
      $.each(contents.items, function(i, content) { 
       if (content.type == "Ink"){ 
        content.load('ink/id'); 
       }       
      }) 
      return context.sync(); 
     }) 
     .then(function(){ 

      // Log ID of every ink content. 
      $.each(contents.items, function(i, content) { 
       if (content.type == "Ink"){ 
        console.log(content.ink.id); 
       }       
      })    
     }); 
}) 
.catch(function(error) { 
    console.log("Error: " + error); 
    if (error instanceof OfficeExtension.Error) { 
     console.log("Debug info: " + JSON.stringify(error.debugInfo)); 
    } 
}); 

回答

1

編輯:雖然不理想,你可以得到RestApiId然後進行API調用來檢索文件的InkML,其中將包含此信息。

https://blogs.msdn.microsoft.com/onenotedev/2017/07/07/onenote-ink-beta-apis/


不幸的是,沒有得到墨水筆劃的座標從OneNote信息加載項的方式。我鼓勵你提交一份uservoice項目並把它鏈接到這裏。

https://onenote.uservoice.com/forums/245490-onenote-developer-apis/

+1

新增的UserVoice –

+0

請求你將如何從加載項獲得RestApiId? –

+0

Here:https://stackoverflow.com/questions/44753454/getrestapiid-function-in-objects-from-office-js-for-onenote –