【发布时间】:2016-07-20 06:36:07
【问题描述】:
我最近一直在使用 OneNote 2013 Interop 创建一个插件。我开始创建一个新页面,我需要将文本从另一个页面复制到新创建的页面。我一直在谷歌上寻找答案,但似乎找不到适合我情况的答案。
OneNote 2013 Interop (NOT API)
我已经检查了 XML 结构,这就是我目前所拥有的。
我的问题看起来很像这个问题:How to write to a OneNote 2013 page using C# and the OneNote Interop
我想添加一个链接,但我的 acc 尚未验证...在 stackoverflow 中搜索该标题,您会看到它。
但我的就像在新页面中提到的一样。我目前所拥有的是我在页面上创建了导致此输出的元素:
<one:Page xmlns:one="http://schemas.microsoft.com/office/onenote/2013/onenote" ID="{1384AF22-F63D-4880-9690-5C6038503D52}{1}{E1949529374926015356741973773722707113107541}" name="Page 3" dateTime="2016-07-20T05:49:31.000Z" lastModifiedTime="2016-07-20T05:49:31.000Z" pageLevel="2">
<one:QuickStyleDef index="0" name="PageTitle" fontColor="automatic" highlightColor="automatic" font="Calibri Light" fontSize="20.0" spaceBefore="0.0" spaceAfter="0.0" />
<one:PageSettings RTL="false" color="automatic">
<one:PageSize>
<one:Automatic />
</one:PageSize>
<one:RuleLines visible="false" />
</one:PageSettings>
<one:Title lang="nl-BE">
<one:OE author="Vince Eeckhout" authorInitials="VE" authorResolutionID="<resolutionId provider="Windows Live" hash="EkqFbCZ8WfIDi9LBAf7kjA=="><localId cid="1c606a1f4bf7dc24"/></resolutionId>" lastModifiedBy="Vince Eeckhout" lastModifiedByInitials="VE" lastModifiedByResolutionID="<resolutionId provider="Windows Live" hash="EkqFbCZ8WfIDi9LBAf7kjA=="><localId cid="1c606a1f4bf7dc24"/></resolutionId>" creationTime="2016-07-20T05:49:31.000Z" lastModifiedTime="2016-07-20T05:49:31.000Z" objectID="{D7A808C9-11B4-4A6C-BA23-C45EFB6722A8}{15}{B0}" alignment="left" quickStyleIndex="0">
<one:T>Page 3</one:T>
</one:OE>
</one:Title>
<one:Outline objectID="{A4942397-ED76-488C-91B8-CC0A0A5BEA4B}{10}{B0}">
<one:Position x="36.0" y="86.4000015258789" z="0">
<one:Size width="143.5806274414062" height="13.42771339416504">
<one:OEChildren>
<one:OE>
<one:T><![CDATA[I'm content of the page]]></one:T>
</one:OE>
</one:OEChildren>
</one:Size>
</one:Position>
</one:Outline>
</one:Page>
当我查看现有页面的结构时,xml 如下:
<one:Page xmlns:one="http://schemas.microsoft.com/office/onenote/2010/onenote" ID="{D98A2E47-1AFB-06BD-2CF0-DFD632DCF8F1}{1}{E1820259626561303932420117111407808163080081}" name="Page 3" dateTime="2016-07-05T09:53:14.000Z" lastModifiedTime="2016-07-11T11:28:20.000Z" pageLevel="2" selected="partial" lang="nl-BE">
<one:QuickStyleDef index="0" name="PageTitle" fontColor="automatic" highlightColor="automatic" font="Calibri Light" fontSize="20.0" spaceBefore="0.0" spaceAfter="0.0" />
<one:QuickStyleDef index="1" name="p" fontColor="automatic" highlightColor="automatic" font="Calibri" fontSize="11.0" spaceBefore="0.0" spaceAfter="0.0" />
<one:PageSettings RTL="false" color="automatic">
<one:PageSize>
<one:Automatic />
</one:PageSize>
<one:RuleLines visible="false" />
</one:PageSettings>
<one:Title lang="nl-BE">
<one:OE author="Vince Eeckhout" authorInitials="VE" lastModifiedBy="Vince Eeckhout" lastModifiedByInitials="VE" creationTime="2016-07-05T09:53:20.000Z" lastModifiedTime="2016-07-05T09:53:20.000Z" objectID="{22153F4F-1C83-017C-056B-278E501AC009}{15}{B0}" alignment="left" quickStyleIndex="0">
<one:T><![CDATA[Page 3]]></one:T>
</one:OE>
</one:Title>
<one:Outline author="Vince Eeckhout" authorInitials="VE" lastModifiedBy="Vince Eeckhout" lastModifiedByInitials="VE" lastModifiedTime="2016-07-11T11:26:56.000Z" objectID="{A4942397-ED76-488C-91B8-CC0A0A5BEA4B}{10}{B0}">
<one:Position x="36.0" y="86.4000015258789" z="0" />
<one:Size width="143.5806274414062" height="13.42771339416504" />
<one:OEChildren>
<one:OE creationTime="2016-07-11T11:26:53.000Z" lastModifiedTime="2016-07-11T11:26:53.000Z" objectID="{A4942397-ED76-488C-91B8-CC0A0A5BEA4B}{11}{B0}" alignment="left" quickStyleIndex="1">
<one:T><![CDATA[I'm content of the page]]></one:T>
</one:OE>
</one:OEChildren>
</one:Outline>
</one:Page>
我认为这似乎是正确的,但是当我想更新页面内容时出现错误:
元素“{http://schemas.microsoft.com/office/onenote/2013/onenote}Position”的上下文中不允许使用文本 根据 DTD/Schema。
你能帮我解决这个问题吗?
感谢您提前回复此问题! :)
【问题讨论】:
标签: c# interop office-interop onenote