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. Image for the cookie policy date

Copy from Excel and Paste to a specific location

Hi,

I am using syncfusion 7.3.0.20 and I need some help with GridControl for WinForms. I need to copy data from excel and paste it into GridControl. GridControl is doing a good job here. The only problem is I dont want to always paste to the area starts from "CurrentCell".

I implemented the ClipboardPaste handler and performed some check there. If the data being pasted satisfies a certain condition, I want to move the CurrentCell to a specific location, say (0,1), so that the data would be pasted from this new "origin". I tried CurrentCell.MoveTo(0,1) in ClipboardPaste handler, it didnt work. CurrentCell was indeed moved, but the data was still pasted to the original place.

I am not sure how the paste function works, but it seems that manipulating CurrentCell is not the correct way. Could you please help give some advice on my question? Thanks!


3 Replies

AK Arun Kumar V Syncfusion Team January 21, 2013 11:30 AM UTC

Hi Xinchao,

Thanks for your interest in Syncfusion products.

Query:

Copy paste from excel to current cell.

I have attached a sample based on copy paste cells from excel, I have also attached a video file which shows how the excel values are pasted from the currentcell of the grid.  please make use of it and let me know if the issue is solved.

Sample : Excel Copy paste.zip

Video   : video.zip

Please let me know if you have any other concerns.

Regards,

Arun.



XI Xinchao January 22, 2013 02:22 AM UTC

Hi Arun,

Thanks for your answer. That's a good example to interact with excel. But I want to ask if it is possible to copy from excel and paste to a grid cell other than the CurrentCell? 

 

Thanks

Xinchao



AK Arun Kumar V Syncfusion Team January 22, 2013 06:31 AM UTC

Hi Xinchao,

Thanks for the update.

Query:

Paste in another cell, than current cell.

If you want to paste the current text other than the current cell then you can customize the currentcellchanging event.

Please refer to the following code snippet.

void gridControl1_CurrentCellChanging(object sender, CancelEventArgs e)

        {

            this.gridControl1.CurrentCell.MoveDown(1);

        }

 

Please let me know if you have any other concerns.

Regards,

Arun.


Loader.
Live Chat Icon For mobile
Up arrow icon