Free Support Forum - aspose.com

.Save writes spreadsheet to html

Hello...I've used cells for standalone apps and never had a prob...I'm writing my first Cells web app using vb.net and the output of the function below ("SaveToExcel()") writes the file directly to the browser, which displays it as the very top of the page versus asking to save the file/xls file. I've tried all "SaveType" and "FileFormatType" options to no avail. Any help/direction/guidance? Thanks. Patrick.

Private Function SaveToExcel() As Integer

Dim loAspose As New pmpAspose

Dim designerFile As String = loAspose.Common_FileDir & "Patient_Revenues.xls"

Trace.Write(designerFile)

Try

Dim license As Aspose.Cells.License = New Aspose.Cells.License()

license.SetLicense("Aspose.Custom.lic")

'--- you must get the

Dim designer As WorkbookDesigner = New WorkbookDesigner()

With designer

.Open(designerFile)

.SetDataSource("Rev_NM1_FID1433", "Patrick")

'.SetDataSource("Location", lsLocation)

'.SetDataSource("NumBeds", lnNumBeds)

'.SetDataSource("HospDemog", lsHospDemog)

.Process()

.Save("Patient_Revenues.xls", SaveType.OpenInExcel, FileFormatType.Default, Me.Response) ', SaveType.OpenInExcel, FileFormatType.Default

End With

designer = Nothing

Catch ex As Exception

Trace.Warn("PMP Exception: ", ex.ToString)

Finally

End Try

End Function

When you write the file to client browser, Open/Save prompt window will always show because it must to tell the user that a binary file will be downloaded. If you want to display an Excel on web pages, you can try another Aspose product: Aspose.Grid. You can download it at http://www.aspose.com/Downloads/Aspose.Grid/Default.aspx . And online demos can be accessed at http://www.aspose.com/Products/Aspose.Grid/Demos/ .