Note: using Syncfusion.Grid v188.8.131.52
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
If grd.Selections.GetSelectedRanges(RangeInfo, True) = True Then
For Each Range In RangeInfo
Select Case Range.RangeType
UpdateRange = Range
UpdateRange = Range.Cells(1, 1, grd.RowCount, grd.ColCount)
UpdateRange = Range.Cells(Range.Top, 1, Range.Bottom, grd.ColCount)
UpdateRange = Range.Cells(1, Range.Left, grd.RowCount, Range.Right)
grd.ChangeCells(UpdateRange, Style, Syncfusion.Styles.StyleModifyType.Changes)
ps. I have also tried Syncfusion.Styles.StyleModifyType.Override
ADAdministrator Syncfusion Team September 30, 2004 12:51 AM
ChangeCells seems to work OK to set styles and have them copied and pasted in the attached sample using 184.108.40.206. Does this sample work for you? (If you get a syntax error when you try to compile it with 220.127.116.11, just comment out the lines with the errors.)
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.)
DEDenisSeptember 30, 2004 04: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.
DEDenisSeptember 30, 2004 04:08 PM
Note: I need the Tag property to be copied across also (with the paste operation).
DEDenisSeptember 30, 2004 04: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
a.m_Dependants = Nothing
a.Col = m_Col
a.Formula = m_Formula
a.FormulaExists = m_FormulaExists
a.Ref = m_Ref
a.Row = m_Row
ADAdministrator Syncfusion Team September 30, 2004 04: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
ADAdministrator Syncfusion Team September 30, 2004 04:29 PM
Looks like th epointed brackets got eaten by the web posting. Here is your sample back wiyh this code change.
Public Class cGridCellTag
ADAdministrator Syncfusion Team September 30, 2004 04:32 PM