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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copy/Paste issue

Thread ID:

Created:

Updated:

Platform:

Replies:

21681 Nov 17,2004 12:27 PM UTC Nov 17,2004 08:11 PM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 17, 2004 12:27 PM UTC

Hi, I am having a problem with pasting into the Grid. I am coping several different columns from the source, but Ctrl-V pastes everything into the first column in the grid, while if I paste it into excel it works fine. What can I do to make sure it splits up the data into different column? Is there a feature similar to "Text to Columns" option in Excel?

Administrator [Syncfusion]
Replied On November 17, 2004 03:17 PM UTC

If you are copying this from a grid to a grid, it should work. If you are having a problme with this, can you post a sample showing it or tell us how to see it in one of our samples. If you are copying it from outside the grid, the default grid implementation expects tab delimited data (tabs between columns and newlines between rows). If you have some other kind of data, then you would have to handle the ClipboardPaste event, amd do the paste yourself.

Administrator [Syncfusion]
Replied On November 17, 2004 04:13 PM UTC

I am actually copying from an outside source, which is a table on a website. The rows are recognized just fine. As for columns, there are empty spaces between the columns(not tabs), but I guess that''s not enough to defferentiate between them. Can you give me some examples of how to handle it through a ClipboardPaste event, I am kind of new to all of this. Thank you for your help.

Administrator [Syncfusion]
Replied On November 17, 2004 05:35 PM UTC

Take a look at this forum thread. It may be enough to get you going. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9389

Administrator [Syncfusion]
Replied On November 17, 2004 07:34 PM UTC

I''ve looked through the code, but I am not sure how this is helpful. Is it possible, let''s say, to replace the empty spaces separating columns with tabs while the data is in the clipboard so it will paste it into separate columns instead of one? I don''t want to take the data in the first column and manually parse it to divide up into the proper columns after it''s been pasted. Thanks again.

Administrator [Syncfusion]
Replied On November 17, 2004 08:11 PM UTC

You can use the code from teh sample to get teh string, and then do your replacement and put it back on teh clipboard and then let teh grid continue handling the paste at that point.
private void gridControl1_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
	IDataObject data = Clipboard.GetDataObject();
	if(data != null && data.GetDataPresent(typeof(string)))
	{
		string s = (string)data.GetData(typeof(string));
		s = s.Replace(" ", "\t");
		Clipboard.SetDataObject(s);
	}
}

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.

Warning Icon 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.Close Icon

;