Export to excel from crystal reports
-
Respected Gurus I am developing in asp.net1.1 and crystalreports. I have some reports,developed in crystal reports which i have to export to excel. Public Sub exportfinalreport() Dim oStream As New MemoryStream ' // using System.IO 'this contains the value of the selected export format. showfinalreport(dtReportdate) oStream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel) Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel" Try Response.BinaryWrite(oStream.ToArray()) Response.End() Catch err As Exception Response.Write("< BR >") Response.Write(err.Message.ToString) End Try End Sub The above code successfully export data to excel. But problem is look and feel. Data in excel does not come under their corresponding headers, which creates confusion. Is there a better way to export to excel with a good look and feel.