We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Paste into Grid without ColHeaders...

Thread ID:

Created:

Updated:

Platform:

Replies:

10156 Jan 23,2004 07:45 AM Jan 23,2004 08:44 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 23, 2004 07:45 AM

Hello! We have a grid an we are allowing to copy cells from the Grid. We include the colheaders using: grid.Model.CutPaste.ClipboardFlags |= GridDragDropFlags.ColHeader; We use the colheaders to be able to paste nicely in Excel. But when we are going to paste into our grid we would like to eliminate the ColHeaders that were copied before. How can we achieve that? Thanks in advance Jorge

Administrator [Syncfusion]
Replied On January 23, 2004 08:22 AM

When you go to paste into the grid, how is the grid suppose to know what was copied onto the clipboard (from wherever it was copied) actually contains headers. So your user copies just a group of cells, and then pastes them back into the grid some. The default grid behavior does not mark cells that get pasted as being header cells. It just puts the values of the cells onto the clipboard. So, using the default behavior there is no perfect way to look at the clipboard contents and know some of the cells came from a header. So, to handle things in a fool proof way, I think the solution would be to place a custom DataObject on the clipboard. You custom dataobject would somehow distinguish between header cells and other cells. To do this, you could handle the Model.ClipboardCopy event and create your custom object there and put it on th e clipboard. Then you could handle the Model.ClipboardPaste event to paste this custom object back into the grid. Here is a link to some sample code that uses the ClipboardCopy event to manage special behavior. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9906 Here is a link to a forum post using ClipboardPaste. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9389 Now if you want to make assumptions like the first row always contains headers, this would simplify what you need to do, and you could probably get away with using the standard support for Copy and only handle the Paste to throw away the first row. But I am not sure if this assumption will serve your needs. If you get stuck doing this, this is the kind of your can submit as a Direct Trac support incident and we can probably get you over the task.

Administrator [Syncfusion]
Replied On January 23, 2004 08:44 AM

Hi, Actually we can paste to the grid data copied from excel, so We cannot assume the first row is always the header. Thinking on that I think the workaround I am going to use is to have a flag in true when we copy something from our grid and keep the string copied. So when pasting we check both variables and delete the first row if necessary. Thanks a lot for your help, Jorge

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;