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/paste of header cells

I would like to be able to select a range of cells (including the row/col headers), copy them, and then paste them into Excel. However, the default behavious only copies the standard cells, not the headers. Is there any quick way round this, or do I have to write my open copy/paste code? Thanks Akash

2 Replies

AD Administrator Syncfusion Team September 22, 2005 01:32 PM UTC

Hi Akash, You can use the ClipboardCopy event to add the column headers to the ranges being copied. Below is a snippet. private void Model_ClipboardCopy(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e) { if(!e.RangeList.AnyRangeContains(GridRangeInfo.Row(0))) { e.ClipboardFlags |= GridDragDropFlags.ColHeader; e.RangeList.Add(GridRangeInfo.Row(0)); } } Best regards, Jay N


AD Administrator Syncfusion Team September 30, 2005 03:08 PM UTC

Thanks Jay, All I needed was the clipboardflags settings - I only want to include the row/col headers if the user has selected them. Akash >Hi Akash, >You can use the ClipboardCopy event to add the column headers to the ranges being copied. Below is a snippet. > > >private void Model_ClipboardCopy(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e) >{ >if(!e.RangeList.AnyRangeContains(GridRangeInfo.Row(0))) >{ >e.ClipboardFlags |= GridDragDropFlags.ColHeader; >e.RangeList.Add(GridRangeInfo.Row(0)); >} >} > > >Best regards, >Jay N

Loader.
Live Chat Icon For mobile
Up arrow icon