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.
Unfortunately, activation email could not send to your email. Please try again.

How can I suppress hidden columns/rows

Thread ID:

Created:

Updated:

Platform:

Replies:

9906 Jan 15,2004 04:19 PM Jan 16,2004 09:23 AM Windows Forms 3
loading
Tags: GridControl
MT Krishnan
Asked On January 15, 2004 04:19 PM

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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;
	}
}

MT Krishnan
Replied On January 16, 2004 09:23 AM

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

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.

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.

;