简体   繁体   English

如何使用C#将所有Onenote页面导出到mht文件

[英]How use C# to export all Onenote pages to mht file

I have an Onenote note, which contains 3 sections and 2 pages for each, ie totally there are 6 pages. 我有一个Onenote笔记,其中包含3个部分和每个2页,即总共有6页。

How should I write C# code to automatically export all those 6 pages to 6 mht files? 我应该如何编写C#代码以自动将所有这6个页面导出到6个mht文件?

You can use the OneNote API . 您可以使用OneNote API

The REST API lets you read the sections, see the notes in them, and export the notes in HTML (with some limitations, like lack of math and handwriting support). REST API允许您阅读这些部分,查看其中的注释,并以HTML格式导出注释(有一些限制,例如缺乏数学和手写支持)。

Microsoft provides code samples , you can see if there's anything you can use there. Microsoft提供了代码示例 ,您可以查看是否有任何可以在那里使用的代码。

Jadeson, if your notebooks exist in Office 365 or OneDrive, you may use the service API as Ezhik suggests. Jadeson,如果您的笔记本存在于Office 365或OneDrive中,您可以使用服务API,如Ezhik建议的那样。 If they do not and you have a Win32 OneNote installation, you may use the OneNote COM API - https://github.com/OneNoteDev/VanillaAddIn . 如果他们没有安装Win32 OneNote,您可以使用OneNote COM API - https://github.com/OneNoteDev/VanillaAddIn It is in C# and you can find documentation for that actual APIs here: https://msdn.microsoft.com/en-us/library/office/jj680120.aspx 它位于C#中,您可以在此处找到该实际API的文档: https//msdn.microsoft.com/en-us/library/office/jj680120.aspx

In case neither MS Interop nor OneNote API is an option for you, look on proprietary Aspose.Note . 如果MS Interop和OneNote API都不是您的选择,请查看专有的Aspose.Note To use it you need to explicitly set the path for each OneNote document (Section) and then extract necessary data or probably directly export it to HTML: 要使用它,您需要显式设置每个OneNote文档的路径(部分),然后提取必要的数据或者可能直接将其导出为HTML:

Document doc = new Document("in.one");
doc.Save("out.html");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM