Monday, December 6, 2010

OneNote Publish to PDF

Microsoft.Office.Interop.OneNote Publish. To publish the entire notebook, use the code below, where Personal is the name and folder of my notebook. The Publish action will find all the .one files and combine them into one pdf file. Whammooo!!

var onenoteApp = new Microsoft.Office.Interop.OneNote.Application();

string bstrHierarchyID = string.Empty;
onenoteApp.OpenHierarchy(@"C:\Users\brad.test\Documents\OneNote Notebooks\Personal\",
System.String.Empty, out bstrHierarchyID, Microsoft.Office.Interop.OneNote.CreateFileType.cftNone);

string bstrTargetFilePath = "C:\\Temp\\Personal1.pdf";

onenoteApp.Publish(bstrHierarchyID, bstrTargetFilePath, OneNote.PublishFormat.pfPDF);

1 comments:

Anonymous said...

Hi, i just want to say hello to the community