我最近使用OneNote 2013 Interop创建了一个附加组件。我来自于创建新页面的部分,我需要将文本从另一个页面复制到新创建的页面。我一直在寻找和搜索谷歌找到答案,但似乎我无法找到适合我的情况。
OneNote 2013 Interop (NOT API)
我已经检查了XML结构,这就是我现在所拥有的。
我的问题看起来与此类似:如何使用C#和OneNote Interop写入OneNote 2013页面
我想添加一个链接,但我的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>
在我看来这似乎是正确的,但是当我想要更新页面内容时出现错误:
在元素&#39; {http://schemas.microsoft.com/office/onenote/2013/onenote}位置&#39;的上下文中不允许使用文字。 根据DTD / Schema。
你可以帮我这个吗?
感谢您提前回复此事! :)
答案 0 :(得分:0)
我在你的尝试中看到了一些错误:
根据ms onenote 2010计划&#34;一:位置&#34;和&#34;一:尺寸&#34;不得包含显示的内容。你把内容放在里面。最佳做法是让它们自动关闭。
此外,即使不是你的情况,title元素中的字符串也可能导致问题。所以你应该避免直接在你的&#34; one:T&#34; -Element中生成文本,而不是在你的&#34; one:T&#34; -Element中生成一个&#34; CDATA&#34; -Element。
如果你将Position和Size-Elements更改为自动关闭,它应该可以工作;)