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

How can I suppress hidden columns/rows

How can I do the following in a GridControl 1. How can I suppress hidden columns/rows from being copied to the clipboard? 2. Copy the cell style (like font, BG/FG colour) to Excel? TIA for your help folks. Cheers, MTK

3 Replies

AD Administrator Syncfusion Team January 16, 2004 03:57 AM

1) You will have to handle things yourself. Handle ClipboardCopy and copy the cells you want to copy. Below is a try at this. 2) We will support copying BIFF (xls) in the grid in a future release through the new ExcelRW library that we are releasing as part of 2.0. We actually are trying to get this in the grid code for the 2.0 release itself, but since the work has not been completed yet, I am not sure if it will make this release or not. We eould like for it to be included, but just don''t know yet.


AD Administrator Syncfusion Team January 16, 2004 03:59 AM

I forgot to post the code snippet for 1. Here it is.
private void gridControl1_ClipboardCopy(object sender, GridCutPasteEventArgs e)
{
	GridRangeInfo range = e.RangeList.ActiveRange;
	if(!range.IsEmpty)
	{
		range = range.ExpandRange(1,1, this.gridControl1.RowCount, this.gridControl1.ColCount);					string s = "";
		GridData data = this.gridControl1.Data;
		for(int row = range.Top; row <= range.Bottom; ++row)
		{
			if(!this.gridControl1.Rows.Hidden[row])
			{
				bool firstCol = true;
				for(int col = range.Left; col <= range.Right; ++col)
				{
					if(!this.gridControl1.Cols.Hidden[col])
					{
						if(!firstCol)
							s += "\t";
						else
							firstCol = false;
						GridStyleInfo style = new GridStyleInfo(data[row, col]);
						s += style.Text;
					}
				}
				s += Environment.NewLine;
			}
		}
		Clipboard.SetDataObject(s);
		e.Handled = true;
	}
}


MK MT Krishnan January 16, 2004 09:23 AM

Thanks Clay. Thats simple and elegant. Cheers, MTK.

Loader.
Live Chat Icon For mobile
Up arrow icon