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.

Copy/Paste of styles

Thread ID:

Created:

Updated:

Platform:

Replies:

19603 Sep 29,2004 07:23 PM Sep 30,2004 05:43 PM Windows Forms 8
loading
Tags: GridControl
Denis
Asked On September 29, 2004 07:23 PM

Note: using Syncfusion.Grid v1.6.1.8 I am trying to copy/paste styles at the moment and am having limited success. When I change cells like this: Me.grd(4, 4).BackColor = System.Drawing.Color.Orange Me.grd(4, 4).Text = "Test" I can copy/cut/paste the styles by default (as expected). But when I update cells like the following, only the text is cut/copy/pasted (not the styles). Dim Range As Syncfusion.Windows.Forms.Grid.GridRangeInfo Dim RangeInfo As Syncfusion.Windows.Forms.Grid.GridRangeInfoList Dim Style As Syncfusion.Windows.Forms.Grid.GridStyleInfo Dim UpdateRange As Syncfusion.Windows.Forms.Grid.GridRangeInfo Style = New Syncfusion.Windows.Forms.Grid.GridStyleInfo Style.Font.Bold = Tool.Checked grd.CurrentCell.EndEdit() If grd.Selections.GetSelectedRanges(RangeInfo, True) = True Then For Each Range In RangeInfo Select Case Range.RangeType Case Syncfusion.Windows.Forms.Grid.GridRangeInfoType.Cells UpdateRange = Range Case Syncfusion.Windows.Forms.Grid.GridRangeInfoType.Table UpdateRange = Range.Cells(1, 1, grd.RowCount, grd.ColCount) Case Syncfusion.Windows.Forms.Grid.GridRangeInfoType.Rows UpdateRange = Range.Cells(Range.Top, 1, Range.Bottom, grd.ColCount) Case Syncfusion.Windows.Forms.Grid.GridRangeInfoType.Cols UpdateRange = Range.Cells(1, Range.Left, grd.RowCount, Range.Right) End Select grd.ChangeCells(UpdateRange, Style, Syncfusion.Styles.StyleModifyType.Changes) Next End If ps. I have also tried Syncfusion.Styles.StyleModifyType.Override

Administrator [Syncfusion]
Replied On September 30, 2004 01:51 AM

ChangeCells seems to work OK to set styles and have them copied and pasted in the attached sample using 2.1.0.9. Does this sample work for you? (If you get a syntax error when you try to compile it with 1.6.1.8, just comment out the lines with the errors.) CopyPaste_8066.zip In the debugger, have you checked the range that you are using in your ChangeCells call to make sure it is what you expect? (ModifyStyle is probably the flag you need to use.)

Denis
Replied On September 30, 2004 05:01 PM

Thanks for the quick response Clay. Your example helped me narrow the issue down. The reason why the styles arent copying across is because I have an object stored in the Tag property. See the attached example for what I mean. When you attempt a paste, the app hangs for a second or so and then just pastes the text. CopyPaste_4054.zip

Denis
Replied On September 30, 2004 05:08 PM

Note: I need the Tag property to be copied across also (with the paste operation).

Denis
Replied On September 30, 2004 05:21 PM

I have also tried to implement ICloneable for the class I am using for the Tag (thinking thats what the problem might be). It didnt make a difference :/ Public Function Clone() As Object Implements System.ICloneable.Clone Dim a As New cGridCellTag If Not m_Dependants Is Nothing Then a.m_Dependants = m_Dependants.Clone Else a.m_Dependants = Nothing End If a.Col = m_Col a.Formula = m_Formula a.FormulaExists = m_FormulaExists a.Ref = m_Ref a.Row = m_Row Return a End Function

Administrator [Syncfusion]
Replied On September 30, 2004 05:24 PM

In order to have copy/paste operations work for abitrary objects, they need to be serializable. So, in your object class definition, you should add the serializable attribute. _ Public Class cGridCellTag ......

Administrator [Syncfusion]
Replied On September 30, 2004 05:29 PM

Looks like th epointed brackets got eaten by the web posting. Here is your sample back wiyh this code change. CopyPaste_4054_3894.zip
 _
Public Class cGridCellTag

Administrator [Syncfusion]
Replied On September 30, 2004 05:32 PM

I pasted the old project. Sorry. Here is the modified one. CopyPaste_9300.zip

Denis
Replied On September 30, 2004 05:43 PM

It worked perfectly! Thanks :)

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.

;