Exporting CrystalReport.Net to excel
Hi!
Pls help me exporting my Crytal Report to excel. I am using this code, but am not able to get the formatting right.
Code:
public void SetFormatExcel(CrystalDecisions.CrystalReports.Engine.ReportDocument MyReport, Boolean UseConstantColumnWidth,int ColumnWidth,Boolean UseColumnHeadings)
{
MyReport.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel;
CrystalDecisions.Shared.ExcelFormatOptions Options = new CrystalDecisions.Shared.ExcelFormatOptions ();
Options.ExcelUseConstantColumnWidth = UseConstantColumnWidth;
Options.ExcelConstantColumnWidth = ColumnWidth;
Options.ExcelTabHasColumnHeadings = UseColumnHeadings;
MyReport.ExportOptions.FormatOptions = Options;
ClearResponse();
Response.ContentType = @"application/vnd.ms-excel";
}