Click here to Skip to main content
11,921,316 members (61,795 online)
Rate this:
Please Sign up or sign in to vote.
See more: clipboard Interop
I am having an issue copying clipboard data from OneNote 2010. I would like to be able to copy the clipboard, serialized it and paste it back in. But it always loses its formatting (OneNote HTML..) so the text and images are not arranged in the way that they were copied. I'm just using the .NET Clipboard class and the IDataObject Interface. Thanks for any help.

Here Is an Example:
public partial class Form1 : Form
  IDataObject clipboard;
  public Form1()
  private void getButton_Click(object sender, EventArgs e)
    clipboard = Clipboard.GetDataObject();
    for (int i = 0; i < clipboard.GetFormats(true).Length; i++)
      chatHist.Text += clipboard.GetFormats(true)[i] + Environment.NewLine;
  private void sendButton_Click(object sender, EventArgs e)

Formats Returned:
OneNote 2010 Internal
Ink Serialized Format
HTML Format

Posted 9-Jul-12 7:21am
Edited 25-Jul-12 8:43am
Richard MacCutchan 9-Jul-12 14:23pm
You need to show the code that you are using so people can advise what, if anything, you are doing wrong. Also be specific about the problem, explain the exact data that is on the clipboard and show what you get out of it.
cswimmer 10-Jul-12 15:41pm
Hi Richard, Thanks for the advice, I've gone ahead and included more information.
Richard MacCutchan 10-Jul-12 16:05pm
It looks like the data is copied but you are losing some formatting information within your code. This is possibly a Microsoft Office issue, as I know they have some extra features in cut and paste.
cswimmer 23-Jul-12 13:01pm
Would it be possible to use OneNote Interop to do this? I was reading about the GetBinaryPageContent Method of that API, which returns all the data of a chosen page in OneNote XML format. Is there some way I could extract my selection from the XML and persist it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 583
1 Dave Kreskowiak 245
2 phil.o 160
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,951
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,171
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100