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.

Limiting pasting area

Thread ID:

Created:

Updated:

Platform:

Replies:

88469 Jul 24,2009 03:43 PM Jul 31,2009 01:32 PM Windows Forms 6
loading
Tags: Grouping
Stephane _
Asked On July 24, 2009 03:43 PM

Hi,

I'm looking at limiting the size of the pasting area.

If I take the FirstGroupingGrid as an example. If a user copy a column of 20 rows in Excel. Then paste it on one of the cell in the wins column. I want the pasting to stop as soon as it encounters a row with a different sport.

I’ve looked at the GridModel.ClipboardCanPaste event but it does not seem to contain the position of the pasting area.

Any help will be appreciated!

Thanks!

Lingaraj S [Syncfusion]
Replied On July 28, 2009 08:39 AM

Hi Stephane,

Thank you for your interest in Syncfusion product.

If you want to get the pasted range in the ClipboardCanPaste event, then please try using RangeList.ActiveRange property to achieve this behavior. If you want to cancel the Paste in GriGroupingControl, please try using Handled and Result property in GridGroupingControl to achieve this behavior.

Refer the code below:

------------C# Code----------------------------
this.gridGroupingControl1.TableModel.ClipboardCanPaste += new GridCutPasteEventHandler(TableModel_ClipboardCanPaste);
void TableModel_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
GridRangeInfo ran = e.RangeList.ActiveRange;
if (ran.Left != 2) // Pasting only allow with the second column
{
e.Handled = true;
e.Result = false;
}
}
---------VB Code------------------------
AddHandler gridGroupingControl1.TableModel.ClipboardCanPaste, AddressOf TableModel_ClipboardCanPaste
Private Sub TableModel_ClipboardCanPaste(ByVal sender As Object, ByVal e As GridCutPasteEventArgs)
Dim ran As GridRangeInfo = e.RangeList.ActiveRange
If ran.Left <> 2 Then ' Pasting only allow with the second column
e.Handled = True
e.Result = False
End If
End Sub


Please let me know if you have any queries.

Regards,
Lingaraj S.

Stephane _
Replied On July 28, 2009 10:24 AM

I tried this, no mater what I do I always have.

Bottom = 0
Height = 1
Left = 0
Right = 0
Top = 0
Width = 1



GGCControlVB_b2dfb2b3.zip

Lingaraj S [Syncfusion]
Replied On July 30, 2009 11:08 AM

Hi Stephane,

Sorry for the inconvenience caused.

The Selections.GetSelectedRange method is used to get the SelctedRangeList in GridGroupingControl. If you want to get the pasting area, then please try using ActiveRange property in selected GridRangeInfoList to solve the issue.

Refer the code below:

Private Sub TableModel_ClipboardCanPaste(ByVal sender As Object, ByVal e As GridCutPasteEventArgs)
Dim lis As GridRangeInfoList
Me.gridGroupingControl1.TableModel.Selections.GetSelectedRanges(lis, True)
If lis.ActiveRange.Left <> 2 Then
e.Handled = True
e.Result = False
End If
End Sub


Refer the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/Forums/GGCControlMod.zip

Please let me know if you have any queries.

Regards.
Lingaraj S.

Stephane _
Replied On July 30, 2009 01:23 PM

The lis.ActiveRange seems to give me the current selected cell position not the pasting range.

If I copy a table 3x3 from Excel and paste it in the 2nd column, it will still paste on the other columns.

Is there something that will tell me: "You are curently pasting a set of data that contains 3 columns and 3 rows"
And then tell: "No, I just want to paste 2 columns and 2 rows. Ignore the rest"

Thanks!

Lingaraj S [Syncfusion]
Replied On July 31, 2009 11:23 AM

Hi Stephane,

Thank you for the update.

If you want to paste the Data based on the Clipboard text, then please try looping with clipboard text to achieve this behavior. I've attached a simple sample that illustrate this better.

Refer the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/Forums/GGCControlMod1.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

Stephane _
Replied On July 31, 2009 01:32 PM

Thanks!!

This also fix an other problem I had of knowing when the paste start and when it had finish pasting the data.

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.

;