Click here to Skip to main content
13,042,166 members (92,065 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 6:21am
Updated 25-Jul-12 7: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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2017
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