OneNote XML to Clipboard

D

dyowee

Good day!
Is it possible to paste the Outline fragment of the OneNote XML to the
clipboard programmatically, then paste it to Word as RTF, or retrieve it as
RTF?

Thank you very much.
 
D

dyowee

Good day John! I tried it but it doesn't work. The XML is pasted into the
Word document as is, not just the text part.

Clipboard.SetData(DataFormats.Rtf, @"<one:Outline >" +
" <one:position x=\"120\" y=\"160\"/>" +
" <one:Size width=\"120\" height=\"15\"/>" +
" <one:OEChildren>" +
" <one:OE alignment=\"left\">" +
" <one:T>" +
" <![CDATA[Sample Text]]>" +
" </one:T>" +
" </one:OE>" +
" </one:OEChildren>" +
" </one:Outline>");

object missing = Type.Missing;
ApplicationClass appClass = new ApplicationClass();
Document d = appClass.Documents.Add(ref missing, ref missing,
ref missing, ref missing);
appClass.Selection.Paste();
 
D

dyowee

Good day John! I tried the following code, but it didn't work. The whole XML
got pasted, not just the text part. Why is this so?

Clipboard.SetData(DataFormats.Rtf, @"<one:Outline >" +
" <one:position x=\"120\" y=\"160\"/>" +
" <one:Size width=\"120\" height=\"15\"/>" +
" <one:OEChildren>" +
" <one:OE alignment=\"left\">" +
" <one:T>" +
" <![CDATA[Sample Text]]>" +
" </one:T>" +
" </one:OE>" +
" </one:OEChildren>" +
" </one:Outline>");

object missing = Type.Missing;
ApplicationClass appClass = new ApplicationClass();
Document d = appClass.Documents.Add(ref missing, ref missing,
ref missing, ref missing);
appClass.Selection.Paste();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top