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

Pasting over cells with Syles

How would I go about removing the style for cells that are changed as a result of a paste event? I am trying to set the style in Grid.CellsChanging, but the grid is aparently ignoring my changes.

3 Replies

AD Administrator Syncfusion Team March 3, 2005 07:04 PM

I am not sure I understand what you need. But if you want to turn off pasting styles (and only paste text), you can set: this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles;


JB John Baker March 3, 2005 09:28 PM

Let me try to clarify. I have selected a range A1-A5 (or any arbitrary range from the grid or external source). I set C2 as the current cell. Cells C3 and C5 both have a background color set to Red. Since the range I am pasting will overwrite those cells, I want the red background to go back to white. >I am not sure I understand what you need. > >But if you want to turn off pasting styles (and only paste text), you can set: > >this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles; >


AD Administrator Syncfusion Team March 4, 2005 03:36 AM

Is this a GridControl? If so, try setting e.Style.BackColor in SaveCellInfo for the pasted cells. You can set a flag in gridControl.ClipboardPaste, and test it in SaveCellInfo to indicate you need to set the e.Style.BackColor, and then turn the flag off in gridControl1.Model.ClipboardPasted. If this is a gridDataBoundGrid, then you cannot set backcolors of individual cells. Instead, you woul dneed to handle grid.prepareViewStyleInfo and set e.Style.backColor there dynamically based on e.RowIndex and e.ColIndex. This means you would have to maintin a list of cells you want to specially color, and then check for these cells in PrepareViewStyleInfo.

Loader.
Live Chat Icon For mobile
Up arrow icon