OneNote自动化受挫 [英] OneNote automation frustration

查看:138
本文介绍了OneNote自动化受挫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用COM API自动化OneNote,并且由于API的稀疏性和我遇到的一些问题而感到有点沮丧......我想要做的事情相当简单 我想打开* .one文件并将其另存为PDF。 
从表面上看,使用COM API似乎相当容易,但我遇到了以下问题...

I'm attempting to automate OneNote using the COM API's, and have been a bit frustrated by the sparseness of the API and some of the problems I'm encountering ... What I want to do is fairly simple.  I want to open a *.one file and save it as PDF.  On the surface, this seems reasonably easy with the COM API, but I've encountered the following issues ...


  1. OneNote注册其类作为多用途,所以多个线程都共享相同的ONENOTE.EXE实例。 对于需要同时将多个.one文件转换为pdf的多个客户端线程,这可能会有问题。
  2. 调用OpenHierarchy(),然后将Publish()调用为PDF,XPS,EMF将CRASH ONENOTE。 你需要 b 必须在调用Publish之前调用NavigateTo(),否则ONENOTE会崩溃。  (使用OneNote 2010,顺便说一句)
  3. 从COM自动化调用NavigateTo()时,OneNote将弹出一个GUI窗口。 从自动化角度来看,这是非常不受欢迎的。 有什么方法可以防止这种情况吗?
  4. 一旦我完成.one文件,我该如何关闭它? 唯一的"关闭"方法是CloseNotebook,但我不想关闭笔记本,我只想关闭我刚用OpenHierarchy打开的.one文件。
  5. 完成后,无法通过自动终止ONENOTE。 如果我将1,000个.one文件转换为PDF,一旦我打开它们就无法关闭它们,那么可能OneNote最终会耗尽内存 - 所以
    我需要 一种方式以编程方式关闭它。 或者,我只是"做错了"。 ?
  6. 如何以编程方式关闭页脚?  它们在选择"另存为PDF格式"时会显示在PDF中,即使它是打印选项。
  1. OneNote registers its classes as multiuse, so multiple threads all share the same ONENOTE.EXE instance.  This can be problematic for multiple client threads needing to convert multiple .one files into pdf simultaneously.
  2. Calling OpenHierarchy() followed by Publish() to PDF, XPS, EMF will CRASH ONENOTE.  You must call NavigateTo() before calling Publish, otherwise ONENOTE will crash.  (Using OneNote 2010, btw)
  3. When calling NavigateTo() from COM automation, OneNote will pop open a GUI window.  Highly undesirable from an automation perspective.  Is there any way to prevent this?
  4. Once I'm finished with my .one file, how do I close it?  The only "close" method is CloseNotebook, but I don't want to close a notebook, I just want to close the .one file I just opened with OpenHierarchy.
  5. There's no way to terminate ONENOTE through automation once I'm done with it.  If I am converting 1,000's of .one files to PDF, with no way to close them once I've opened them, then presumably OneNote is going to eventually run out of memory -- so I need a way to shut it down programmatically.  Or, am I just "doing it wrong" ?
  6. How can I turn off the page footers programmatically?  They show up in the PDF when selecting "Save AS PDF", even though it's a print option.

谢谢,

Robert

 

推荐答案

Hello Robert,

Hello Robert,

感谢您发帖。实际上,在这个论坛中,OneNote自动化专家很少。据我所知,您也可以尝试在答案网站上询问。虽然这是最终用户的地方,但是OneNote自动化领域的专家更多。
谢谢。

Thanks for posting. Actually, in this forum, there are few experts in OneNote automation. As far as I see, you also could try to ask in Answer site. Although that's an end-user place, there are more specialists on OneNote automation mostly to be found. Thanks.

OneNote:共享,创建和管理笔记本:

http://social.answers.microsoft.com/Forums/en-IN/addonenote/threads

OneNote: Sharing, Creating and Managing Notebooks:
http://social.answers.microsoft.com/Forums/en-IN/addonenote/threads.

抱歉,我对OneNote自动化不太熟悉。如果您需要我的任何帮助,我会尝试向您提供一些有用的信息。

Sorry, I am not very familiar with OneNote automation. If you need any help from me, I will try to give you some useful information.

如果您对此帖有任何疑虑,请随时跟进。祝你有愉快的一天。

If you have any concern on this post, just feel free to follow up. Have a nice day.

祝你好运,

Bessie Zhao - MSFT

MSDN论坛用户支持

如果您对我们的支持有任何反馈,请联系
msdnmg@microsoft.com


这篇关于OneNote自动化受挫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆