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

GroupingGridExcelConverterControl

How can i have column header text instead of the column field name when exporting to Excel.
is there any reason that "GroupingGridToExcel" method of "GroupingGridExcelConverterControl" exports the field name? or it is a bug!


Thank you
Alenoosh


1 Reply

NA Nisha Arockiya A Syncfusion Team December 8, 2008 07:02 AM UTC

Hi Alenoosh,

Thanks for your interest in Syncfusion Products.

Export HeaderText:
It is possible to export the header text to excel after setting in GridGroupingControl using


//Setting Header text..
private void SetHeaderText(GridModel grid, IWorksheet sheet)
{
//Pass the Range and assign the Header Text
sheet.Range[3, 1].Text = "MyColumn1";
sheet.Range[3, 2].Text = "MyColumn2";
sheet.Range[3, 3].Text = "MyColumn3";
}

///Exporting to Excel..
Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl();
IWorkbook myWorkBook = ExcelUtils.CreateWorkbook(1);
IWorksheet sheet = myWorkBook.Worksheets[0];
converter.GroupingGridToExcel(this.gridGroupingControl1, sheet, Syncfusion.GridExcelConverter.ConverterOptions.Default);
SetHeaderText(this.gridGroupingControl1.TableModel, sheet);


Here is a minimal sample;
http://websamples.syncfusion.com//samples/Grid.Windows/Development/GGC_ExcelExport.zip

Please let me know if this helps.

Regards,
Nisha



Loader.
Live Chat Icon For mobile
Up arrow icon