Wednesday, March 21, 2012

Export .rpt file in to excel sheet

Hello friends:
I would like to export report file from crystal report to excel file so can anybody help me withthat , I am using crystal report version 8.5 and if possible I would like to give option when user click on link to view report he get that result directly in excel file so is it possible ??

Thanks

-Jayesh
jmendpara@.gmail.comwell u dint mention which tool u r using
here i m putting the solution if u r using VB.Net for a web application
u can do minor changes by ur self too

public dim DisplayReportInExcel()
{

LoadReport()
Dim dfdoCustomers As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim szFileName As String = Server.MapPath("")

szFileName = szFileName + "\report.xls"
tempFileName = tempFileName + "xls"
contentType = "application/vnd.ms-excel"
rpt.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel

dfdoCustomers.DiskFileName = szFileName

With rpt
.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportOptions.DestinationOptions = dfdoCustomers
.Export()
End With

Response.Buffer = True
Response.ContentType = contentType
Response.AppendHeader("content-disposition", "attachment; filename=" + tempFileName)
Response.WriteFile(szFileName)
Response.End()

}

In
LoadReport() you can set the dataset to the report as u per ur requirement...|||Hi

I need to do it in Crystal reports 8.5 i mean export the rpt into excel sheet

pls help me|||Thank you very much Noshi316 ,, It works for me ...sql

No comments:

Post a Comment