I have a remote, hosted SQL server that I'm interfacing through Earthsoft's Enterprise web portal. I have created a custom report as a dll that includes a excel document as a resource within the dll. How do I go about providing the final product (Excel document with my datatable) to the user? I have my current code snippet below. The error I'm getting indicates it can't find the "C:\GamaRpt" file. I know that the remote server has the ability to write excel documents as several of the standard reports from Earthsoft generate them.
Code:
' get the data
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
Dim gamaRpt As Array
gamaRpt = Global.My.Resources.ResourceManager.GetObject("BetaGamaRptver6_1")
Global.My.Computer.FileSystem.WriteAllBytes _
("C:\GamaRpt", gamaRpt, False)
wkb = _excelEngine.Excel.Workbooks.Open("C:\GamaRpt")
wkb.StandardFont = "Times New Roman"
Dim xtab As DataTable
wks = wkb.Worksheets.Item("Report")
xtab = GenerateTable(dt)
GenerateSheet(wks, xtab, dt)
' save the workbook to a stream
Dim memStream As New System.IO.MemoryStream
wkb.SaveAs(memStream)
'Allow enterprise reports to be downloaded to client machine
'Response.ContentType = "application/vnd.ms-excel"
'Response.AddHeader("Content-Disposition", "attachment; filename=" & "Report.xlsx")
'wkb.SaveXlsx(ms)
'memStream.WriteTo(Response.OutputStream)
wkb.Close()
' create the report output
Dim reportFileName As String = String.Format("{0}_{1:yyyyMMdd}.xls", Me.Connection.SelectedFacility.Name, Date.Now)
Me._output = New Output(reportFileName, memStream, "application/vnd.ms-excel")
Me._message = "Report " & reportFileName & " completed."