Dim rpt As New ReportDocument
rpt.Load(Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\r12.rpt")
Dim strSelectionFormula As String = "{Employees.BirthDate} in #" & _
DateTimePicker1.Value & "# to #" & DateTimePicker2.Value & "#" & _
" AND {Employees.Title} = '" & ComboBox1.Text & "'"
rpt.RecordSelectionFormula = strSelectionFormula
rpt.ExportToDisk(ExportFormatType.Excel, "D:\Report1.xls")
great work...:)
ReplyDeleteThankx tejal
ReplyDeleteu had done good job.........
ReplyDeleteIt's very Usefull To All Student....
ReplyDeleteSir, how to export data directly from datagridview to excel file or pdf file?
ReplyDelete@Mit if you don't want any filtration to data (To Display all data) you just have to write :
ReplyDeleteDim rpt As New ReportDocument
rpt.Load(Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\r12.rpt")
rpt.ExportToDisk(ExportFormatType.Excel, "D:\Report1.xls")
The work will be done
Thank you sir....
ReplyDeleteMost well come......:-)
ReplyDeleteSir, above code is not working...
ReplyDeleteError is : load report failed
@Mit just change the path of ur report file
ReplyDeleterpt.Load(Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\r12.rpt")
I had used my application directory u have to give actual path of your report file