我正在使用vb.net并尝试从onenote中的笔记中提取文本(我将为OneNote2010或2016解决)。以下代码能够复制标题书籍和章节的名称......到文本框(用于测试),但不是注释的实际内容。我知道这可能是非常简单的,一旦你知道如何做一次。但我对我/谷歌搜索的生活无法弄清楚这个魔法命令。 (在Visual Basic中)。使用XmlDocument从OneNote中提取笔记内容类
感谢您的阅读!
Imports Microsoft.Win32
Imports System.Security.Permissions
Imports Microsoft.Office.Interop
Imports System.Xml
Public Class Form1
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim strNamespace As String = "http://schemas.microsoft.com/office/onenote/2013/onenote"
Dim outputXML As String
Dim onApplication As OneNote.Application = New OneNote.Application
onApplication.GetHierarchy(Nothing, OneNote.HierarchyScope.hsSections, outputXML)
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.LoadXml(outputXML)
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("one", strNamespace)
Dim Testa As XmlNode = xmlDoc.SelectSingleNode("//one:Section[@name='TestNote']", nsmgr)
TextBox1.Text = outputXML
End Sub
End Class
Jayongg嗨, 当我尝试了GetPageContent路线,我收到了“getpagecontent”不是“的OneNote”的成员。也许这是我的问题的路线? 感谢您的所有帮助! – user2261192
奇怪。您是否使用此API:https://msdn.microsoft.com/en-us/library/office/gg649853(v=office.14).aspx – jayongg
我有: “Imports Microsoft.Win32 Imports System.Security。权限 进口Microsoft.Office.Interop 进口System.Xml“ 在顶部...对不起,我还是这个新的。 谢谢 – user2261192