c# - OneNote, inserting elements with UpdatePageContent -
i tried find if possible add together content onenote page via updatepagecontent in microsoft.office.interop.onenote reference.
i want create page default template made in xml, documation of msdn said me function allow construction :
msdn doc :
the objects must include in xml code pass updatepagecontent method page-level objects (such outlines, images on page, or ink on page) have changed. method not modify or remove page-level objects not specify in bstrpagechangesxmlin parameter. method exclusively replaces page-level objects, such outlines, ids match of objects pass. consequently, must specify page-level objects in code, including existing content , changes want create them.
my question : can i, library, add together element in page? if so, how?
thanks
you can utilize omspy tool investigate page content structure. next samples help started:
to set page title when have pageid
private static void sepagetitle(string pageid, string pagetitle) { microsoft.office.interop.onenote.application m_app = new microsoft.office.interop.onenote.application(); string strpagtitle = "<one:page xmlns:one=\"http://schemas.microsoft.com/office/onenote/2010/onenote\" id=\"{0}\" >" + "<one:title selected=\"partial\" lang=\"en-us\">" + "<one:oe style=\"font-family:calibri;font-size:17.0pt\">" + "<one:t><![cdata[{1}]]></one:t> " + "</one:oe>" + "</one:title>" + "</one:page>"; strpagtitle = string.format(strpagtitle, pageid, pagetitle); m_app.updatepagecontent(strpagtitle); }
add element page when have pageid:
private static void setelementinpage(string pageid) { microsoft.office.interop.onenote.application m_app = new microsoft.office.interop.onenote.application(); string strpagecontent = "<one:page xmlns:one=\"http://schemas.microsoft.com/office/onenote/2010/onenote\" id=\"{0}\" >" + "<one:outline>" + "<one:position x=\"36.0\" y=\"86.4000015258789\" z=\"0\" />" + "<one:size width=\"117.001953125\" height=\"40.28314971923828\" />" + "<one:oechildren>" + "<one:oe>" + "<one:t><![cdata[this sample info added test out onenote api functionality. next list item.]]></one:t>" + "</one:oe>" + "</one:oechildren>" + "<one:oechildren indent=\"2\">" + "<one:oe alignment=\"left\">" + "<one:list>" + "<one:bullet bullet=\"2\" fontsize=\"11.0\" />" + "</one:list>" + "<one:t><![cdata[a apple]]></one:t>" + "</one:oe>" + "<one:oe alignment=\"left\">" + "<one:list>" + "<one:bullet bullet=\"2\" fontsize=\"11.0\" />" + "</one:list>" + "<one:t><![cdata[b ball]]></one:t>" + "</one:oe>" + "<one:oe alignment=\"left\">" + "<one:list>" + "<one:bullet bullet=\"2\" fontsize=\"11.0\" />" + "</one:list>" + "<one:t><![cdata[c cat]]></one:t>" + "</one:oe>" + "</one:oechildren>" + "</one:outline>" + "</one:page>"; strpagecontent = string.format(strpagecontent, pageid); m_app.updatepagecontent(strpagecontent); }
c# xml visual-studio-2010 xsd onenote
No comments:
Post a Comment