Loading DataTable to Excel Format
Posted: Sun Feb 05, 2017 6:01 am
Hello,
I'm using ASP.NET web form and VB Language to create report generating page and getting data from created stored procedure that was wrote in MSSQL with 3 input variables. That data were returned as "datatable" datatype in program. I try to bind datatable to report with these codes:
' ------------------------------------------ Data that reurned in datatable format from --------------------------------------------------
Dim ReportInfo As DataTable = ContractReport.GetDetialReport(ContractId, Session("sdate"), Session("edate"))
' -------------------------------------------------------------------------------------------------------------------------------------------------
Dim Report As StiReport = New StiReport()
Report.Load(Server.MapPath("~/reports/Reports.mrt"))
Report.RegData("ReportInfo", ReportInfo)
Report.Render(False)
Dim mySettings = New StiExcelExportSettings()
mySettings.ExportDataOnly = True
mySettings.UseOnePageHeaderAndFooter = True
StiReportResponse.ResponseAsXls(Report, mySettings, True)
I create report template with name of "Reports.mrt" that have no connected to database.With all of attemptions, the generated report was empty. Could you please show me how to do it with sample.
Thanks in advance.
I'm using ASP.NET web form and VB Language to create report generating page and getting data from created stored procedure that was wrote in MSSQL with 3 input variables. That data were returned as "datatable" datatype in program. I try to bind datatable to report with these codes:
' ------------------------------------------ Data that reurned in datatable format from --------------------------------------------------
Dim ReportInfo As DataTable = ContractReport.GetDetialReport(ContractId, Session("sdate"), Session("edate"))
' -------------------------------------------------------------------------------------------------------------------------------------------------
Dim Report As StiReport = New StiReport()
Report.Load(Server.MapPath("~/reports/Reports.mrt"))
Report.RegData("ReportInfo", ReportInfo)
Report.Render(False)
Dim mySettings = New StiExcelExportSettings()
mySettings.ExportDataOnly = True
mySettings.UseOnePageHeaderAndFooter = True
StiReportResponse.ResponseAsXls(Report, mySettings, True)
I create report template with name of "Reports.mrt" that have no connected to database.With all of attemptions, the generated report was empty. Could you please show me how to do it with sample.
Thanks in advance.