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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copying Column Headers (ColHeaders)

Thread ID:

Created:

Updated:

Platform:

Replies:

12529 Apr 1,2004 03:18 PM UTC Apr 1,2004 06:05 PM UTC WinForms 2
loading
Tags: GridControl
Akshay Arora
Asked On April 1, 2004 03:18 PM UTC

I have: this.grid.Model.CutPaste.ClipboardFlags |= GridDragDropFlags.ColHeader; set in my code. This works great when I select the entire grid and copy and paste into Excel. But when I select a single row (or anything but the entire grid), the column headers aren''t copied over. How can I make it so?

Administrator [Syncfusion]
Replied On April 1, 2004 05:12 PM UTC

The column headers need to be part of the selections. If you are using ListBoxSelectionMode, this prevents the columns from being selected (unless you click cell 0,0 which selects the whole table); If you put a button handler with this code in a grid with ListBoxSelectionMode set, then it will select some header cells when you click the button, and then is you ctl+C to copy, it will copy the headers. 9Just to verify it works..) private void button1_Click(object sender, System.EventArgs e) { this.gridControl1.Selections.Add(GridRangeInfo.Cells(0,2,4,3)); this.gridControl1.Focus(); } So, copy headers is sort of a problem with ListBoxMode. You could handle ClipboardCopy event yourself, and put whatever you wanted on the clipboard.

Akshay Arora
Replied On April 1, 2004 06:05 PM UTC

I managed to figure it out by finding some code that I had elsewhere. I guess I had forgotton about it. Random comment - is there anyway to make the Message box when writing a post bigger? This thing is like 2 rows high and 10 columns wide... For reference, this is what I did. this.dataGrid.Model.ClipboardCopy += new GridCutPasteEventHandler( this.HandleClipboadCopy ); private void HandleClipboadCopy( object sender, GridCutPasteEventArgs e ){ e.ClipboardFlags |= GridDragDropFlags.ColHeader; for( int i = 0; i < this.dataGrid.DataBoundGridModel.Selections.Ranges.Count; i++ ){ e.RangeList.Add( GridRangeInfo.Cell( 0, this.dataGrid.DataBoundGridModel.Selections.Ranges[ i ].Left ) ); } }

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;