问题
My customers have roughly 600gb (all together) worth of Onenote 2007 notebooks. Onenote 2016 doesn't allow editting of onenote2007 format notebooks. It requires conversion.
MS doesn't provide a batch conversion utility. MS does provide a notebook-by-notebook conversion via their UI which is clunky. Does anyone know if I could use their Publish API to convert one notebook at a time?
https://msdn.microsoft.com/en-us/library/office/jj680120.aspx#ON14DevRef_Application_Functional (see Publish Method)
回答1:
I gave it a go. You can!
One can use the Publish API method from the Application2 onenote API COM object by opening a 2007 notebook and specifying the export format as PublishFormat.pfOneNote (to export as 2010+ format).
There are some limitations:
- You can only convert a section. So your code will have to open the 2007 notebooks, find the sections, and convert one at a time.
- Sections that have no pages will result in an error code being thrown. So do check that there are pages in the section before attempting conversion.
So, given the limitations, my conversion app will have to:
- Loop through the notebooks in a big folder.
- Open each notebook, iterate through each section, and convert each non-empty section into a new notebook folder.
- Open the new notebook folder and create into it any missing sections.
- Order the sections in the new notebook.
- Save and close both notebooks.
- Repeat.
Here's a partial implementation: https://github.com/PetePeter/onenoteconverter
来源:https://stackoverflow.com/questions/37233438/onenote-2007-notebooks-batch-convert-to-onenote-2010-2013-2016