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.
ADAdministrator Syncfusion Team January 16, 2004 08:57 AM UTC
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.
ADAdministrator Syncfusion Team January 16, 2004 08:59 AM UTC
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;
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)
bool firstCol = true;
for(int col = range.Left; col <= range.Right; ++col)
s += "\t";
firstCol = false;
GridStyleInfo style = new GridStyleInfo(data[row, col]);
s += style.Text;
s += Environment.NewLine;
e.Handled = true;
MKMT KrishnanJanuary 16, 2004 02:23 PM UTC
Thanks Clay. Thats simple and elegant.