Modify Clipboard Cell Info Range and then reload to Clipboard

Posted by: greygranite on 8 September 2017, 1:57 pm EST

  • Posted 8 September 2017, 1:57 pm EST

    Using sample code from other posts, was able to extract the CellInfoRange of the data that was copied from a spreadsheet using the ActiveSheet.ClipboardCopy() command.  But when changing the value of the CellInfo items in the collection, clearing the clipboard, and placing the updated CellInfoRange back into the clipboard, the new values are not taking. 

    The original values in the CellInfoRange are still showing when a paste is performed.

    Please see the following code that was used.  Any suggestions on what to do to get the updated values to take would be appreciated.


    Ed Ostrowski

    Referenced Post

    FarPoint.Win.Spread.dll 4.0.2009.2005

    Executed ClipboardExtract(true) after ActiveSheet.ClipboardCopy() call in the ctrl + v event.

            public void ClipboardExtract(bool updateClipboard)
                int count = 0;

                IDataObject iData = Clipboard.GetDataObject();
                string cbString = Clipboard.GetText();

                String[] allFormats = iData.GetFormats();

                if (iData.GetDataPresent(typeof(FarPoint.Win.Spread.CellInfoRange)))
                    FarPoint.Win.Spread.CellInfoRange cells = (FarPoint.Win.Spread.CellInfoRange)iData.GetData(typeof(FarPoint.Win.Spread.CellInfoRange));

                    for (int row = 0; row < cells.RowCount; row++)
                        for (int col = 0; col < cells.ColumnCount; col++)
                            cells[row, col].Note = "Old Test Value=" + cells[row, col].Value.ToString();
                            cells[row, col].Value = count;

                    // Update the clipboard data object
                    if (updateClipboard)
              //          iData.SetData(cells);
                        Clipboard.SetDataObject(cells, true);


  • Replied 8 September 2017, 1:57 pm EST

    This code is working perfectly to modify the clipboard and when pasted back into the Spread the notes are visible.

    What version are you working with? And do you have a complete sample where we can see this not occuring?


  • Replied 8 September 2017, 1:57 pm EST

    Figuired out what was wrong while putting together a test project.  I failed to suppress the ctrl + c action in the KeyDown event.  Once e.SuppressKeyPress = true was added, then the updating of the DataObject back into the clipboard worked fine.  Without this supress, the changed values were being over written by the original KeyDown event.

    Thanks for the quick response.

    Ed Ostrowski

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels