Each toolbar button launches a user specified program . The details of how to
set that up can be found here...
http://blogs.msdn.com/descapa/archive/2006/08/31/734298.aspx
Here is some code I have to update the title of a page. Instead of putting
in text in the XML you could put in the ink content. I would recommend
looking at a sample XML generated by a OneNote page using OMSpy
http://blogs.msdn.com/descapa/archive/2007/02/12/omspy-a-onenote-developer-s-tool.aspx
This will give you an idea of the kind of XML you will need to put in.
private void changePageTitle(TreeNode tnode, String newTitle)
{
// load page
String pageContent;
onApp.GetPageContent(getAttribute(tnode, "ID"), out pageContent,
OneNote.PageInfo.piAll);
XmlDocument pageXml = new XmlDocument();
// C# note :- if we pass a String we get URI too long error
pageXml.Load(new System.IO.StringReader(pageContent));
string OneNoteNamespace =
"
http://schemas.microsoft.com/office/onenote/2007/onenote";
XmlNamespaceManager nsmgr = new
XmlNamespaceManager(pageXml.NameTable);
nsmgr.AddNamespace("one", OneNoteNamespace);
// Clear Previous Title ( Handwritten or otherwise)
XmlNode titleElem =
pageXml.SelectSingleNode("//one:Title/one:OE", nsmgr);
if (titleElem != null)
{
titleElem.InnerXml = "";
// Create new Tittle Element and push in new title
// IF we want to add Font change functionality code to go
here
XmlElement newTitleNode = pageXml.CreateElement("one:T",
pageXml.DocumentElement.NamespaceURI);
newTitleNode.InnerXml = "<![CDATA[" + newTitle.Trim() + "]]>";
titleElem.AppendChild(newTitleNode);
//newTitleNode.InnerXml = "<![CDATA[Testing]]>";
onApp.UpdatePageContent(pageXml.InnerXml,
System.DateTime.MinValue);
}
}
David said:
Thanks for the tip,
1)About buttons: each toolbar can have only one button?
2)Is there any sample code for adding inks ?
thanks, David