Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Providng excel document to user through web interface

Status
Not open for further replies.

geonebula

Technical User
Apr 11, 2011
12
US
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."
 
Update: I am using SyncFusion's XLsIO library. Also, this report will run from the desktop version of Earthsoft EQuIS Pro as long as the user has write access to the C:\ drive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top