Reg: Export from GridGrouping control to Excel

Hi, I have attached one class file and excel file regarding export data from grid grouping control to excel.Export to excel class file i have taken from syncfusion. Basically, in my contol i dont want to show first three columns in the excel sheet. For that i have added one condition in line No: 159(ie. i have made first three column width equal to zero) But my problem is in the excel sheet header does''t start from ''A''(b''cause i have made first three column width equal to zero) Is it possible to get excel header start from ''A''. And one more thing is, I dont know, why the first row always start from line no:2 in excel sheet. Any idea on this scenario....! GG to Excel_4761.zip

1 Reply

AD Administrator Syncfusion Team September 9, 2005 02:27 PM UTC

I think you can handle this by not adding those columns to Excel at all. You can try to do this by using code like this every time you loop through the columns.
int offset = 0;
if (j == 2 || j == 3 || j == 4) {
	sheet.Range[1,j+1].ColumnWidth = 0;
} else {
	if (grid.TableModel.ColWidths[j] == 0){
		offset = 3;
	} else {
		sheet.Range[1,j+1-offset].ColumnWidth = (grid.TableModel.ColWidths[j]/7.43);
	}
}
You would need to do something similar in every loop through the columns, skipping 2,3,4 and offsetting the column indexes in the excel sheet by 3 as needed.

Loader.
Up arrow icon