Group:  Other Microsoft Office Products ยป microsoft.public.onenote
Thread: Programtically adding Inks to page

Geek News

Programtically adding Inks to page
David 12/8/2008 5:58:01 PM
Hi
I would like to create OneNote 07 addin.
1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
but it has no tolbars/buttons interfaces.
2) I will add new section and page and want to add Microsoft Ink to the
page. I guess I have to serialize Ink and craft some XML, but I connot find
any explanation or API.
Please help,
Thanks, David
RE: Programtically adding Inks to page
Ani 12/8/2008 6:43:03 PM
Here are some resources you might find useful

1.
http://blogs.msdn.com/johnguin/archive/2007/12/20/how-to-create-a-floating-toolbar-in-onenote.aspx

( John's post explaining how to create a toolbar )

2.
http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en

contains the XML schema reference for OneNote which outlines the format for
ink XML.

3. OneNote API :
http://msdn.microsoft.com/en-us/office/aa905452.aspx






"David" wrote:

[Quoted Text]
> Hi
> I would like to create OneNote 07 addin.
> 1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
> but it has no tolbars/buttons interfaces.
> 2) I will add new section and page and want to add Microsoft Ink to the
> page. I guess I have to serialize Ink and craft some XML, but I connot find
> any explanation or API.
> Please help,
> Thanks, David
RE: Programtically adding Inks to page
David 12/8/2008 9:14:05 PM
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


"Ani" wrote:

[Quoted Text]
> Here are some resources you might find useful
>
> 1.
> http://blogs.msdn.com/johnguin/archive/2007/12/20/how-to-create-a-floating-toolbar-in-onenote.aspx
>
> ( John's post explaining how to create a toolbar )
>
> 2.
> http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en
>
> contains the XML schema reference for OneNote which outlines the format for
> ink XML.
>
> 3. OneNote API :
> http://msdn.microsoft.com/en-us/office/aa905452.aspx
>
>
>
>
>
>
> "David" wrote:
>
> > Hi
> > I would like to create OneNote 07 addin.
> > 1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
> > but it has no tolbars/buttons interfaces.
> > 2) I will add new section and page and want to add Microsoft Ink to the
> > page. I guess I have to serialize Ink and craft some XML, but I connot find
> > any explanation or API.
> > Please help,
> > Thanks, David
RE: Programtically adding Inks to page
Ani 12/8/2008 10:08:00 PM
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" wrote:

[Quoted Text]
> 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
>
>
> "Ani" wrote:
>
> > Here are some resources you might find useful
> >
> > 1.
> > http://blogs.msdn.com/johnguin/archive/2007/12/20/how-to-create-a-floating-toolbar-in-onenote.aspx
> >
> > ( John's post explaining how to create a toolbar )
> >
> > 2.
> > http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en
> >
> > contains the XML schema reference for OneNote which outlines the format for
> > ink XML.
> >
> > 3. OneNote API :
> > http://msdn.microsoft.com/en-us/office/aa905452.aspx
> >
> >
> >
> >
> >
> >
> > "David" wrote:
> >
> > > Hi
> > > I would like to create OneNote 07 addin.
> > > 1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
> > > but it has no tolbars/buttons interfaces.
> > > 2) I will add new section and page and want to add Microsoft Ink to the
> > > page. I guess I have to serialize Ink and craft some XML, but I connot find
> > > any explanation or API.
> > > Please help,
> > > Thanks, David
RE: Programtically adding Inks to page
David 12/9/2008 1:59:38 PM
Hi
thanks for erpsonse, its very useful.
About inks : xml node has position and size attributes, but what is a
coordinate system that OneNote uses to plcae its objects?
what this means :
<one:Position x="404.2488098144531" y="41.41414642333984" z="25" />
<one:Size width="68.28662109375" height="157.1244049072266" />
David.

"Ani" wrote:

[Quoted Text]
> 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" wrote:
>
> > 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
> >
> >
> > "Ani" wrote:
> >
> > > Here are some resources you might find useful
> > >
> > > 1.
> > > http://blogs.msdn.com/johnguin/archive/2007/12/20/how-to-create-a-floating-toolbar-in-onenote.aspx
> > >
> > > ( John's post explaining how to create a toolbar )
> > >
> > > 2.
> > > http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en
> > >
> > > contains the XML schema reference for OneNote which outlines the format for
> > > ink XML.
> > >
> > > 3. OneNote API :
> > > http://msdn.microsoft.com/en-us/office/aa905452.aspx
> > >
> > >
> > >
> > >
> > >
> > >
> > > "David" wrote:
> > >
> > > > Hi
> > > > I would like to create OneNote 07 addin.
> > > > 1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
> > > > but it has no tolbars/buttons interfaces.
> > > > 2) I will add new section and page and want to add Microsoft Ink to the
> > > > page. I guess I have to serialize Ink and craft some XML, but I connot find
> > > > any explanation or API.
> > > > Please help,
> > > > Thanks, David
RE: Programtically adding Inks to page
David 12/10/2008 10:17:02 PM
Hi
I still cannot understand how Ink element shall be crafted. How shall I
create ObjectID? Any chance for real sample code? ( not "add blankpage,add
title thing")
Documenation is very,very poor here...
Please help.
David


"David" wrote:

[Quoted Text]
> Hi
> thanks for erpsonse, its very useful.
> About inks : xml node has position and size attributes, but what is a
> coordinate system that OneNote uses to plcae its objects?
> what this means :
> <one:Position x="404.2488098144531" y="41.41414642333984" z="25" />
> <one:Size width="68.28662109375" height="157.1244049072266" />
> David.
>
> "Ani" wrote:
>
> > 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" wrote:
> >
> > > 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
> > >
> > >
> > > "Ani" wrote:
> > >
> > > > Here are some resources you might find useful
> > > >
> > > > 1.
> > > > http://blogs.msdn.com/johnguin/archive/2007/12/20/how-to-create-a-floating-toolbar-in-onenote.aspx
> > > >
> > > > ( John's post explaining how to create a toolbar )
> > > >
> > > > 2.
> > > > http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en
> > > >
> > > > contains the XML schema reference for OneNote which outlines the format for
> > > > ink XML.
> > > >
> > > > 3. OneNote API :
> > > > http://msdn.microsoft.com/en-us/office/aa905452.aspx
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "David" wrote:
> > > >
> > > > > Hi
> > > > > I would like to create OneNote 07 addin.
> > > > > 1) How can I add custom toolbar and button to OneNote? I found IOneNoteAddIn
> > > > > but it has no tolbars/buttons interfaces.
> > > > > 2) I will add new section and page and want to add Microsoft Ink to the
> > > > > page. I guess I have to serialize Ink and craft some XML, but I connot find
> > > > > any explanation or API.
> > > > > Please help,
> > > > > Thanks, David

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net