此页面描述了如何与Microsoft OneNote
:https://docs.microsoft.com/en-us/office/client-developer/onenote/application-interface-onenote
我想使用C# Code Example
将此JACOB
转换为Java:
static void GetEntireHierarchy()
{
String strXML;
OneNote.Application onApplication = new OneNote.Application();
onApplication.GetHierarchy(null,
OneNote.HierarchyScope.hsPages, out strXML);
Clipboard.SetText(strXML);
MessageBox.Show("The XML has been copied to the clipboard");
}
我不确定如何在Java中实现通过引用传递的字符串?
这是我目前的做法:
String[] myArray = new String[] {""}
ActiveXComponent oneNote = new ActiveXComponent("OneNote.Application")
Dispatch dispatch = Dispatch.call(oneNote, "GetHierarchy", new Object[] {null, "OneNote.HierarchyScope.hsPages", myArray}).toDispatch()
但是我得到了这个例外:
Caused by: com.jacob.com.ComFailException: Can't map name to dispid:
GetHierarchy at com.jacob.com.Dispatch.invokev(Native Method) at
com.jacob.com.Dispatch.invokev(Dispatch.java:625) at
com.jacob.com.Dispatch.callN(Dispatch.java:453) at
com.jacob.com.Dispatch.call(Dispatch.java:541)
有什么主意吗?