Free Support Forum -

Page output while processing file

I’m looking to send status updates to the browser window while the
excel file is processing via response.flush. When I try the follwoing

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Call CreateReport()

End Sub

Public Sub CreateReport()

Dim i As Integer

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

'Pass only the name of the license file embedded in the assembly


Dim path As String = AppSettings(“templatesFolder”) & “test.xls”

Dim workbook As Workbook = New Workbook


Dim sheets As Worksheets = workbook.Worksheets

Dim cells As Cells = workbook.Worksheets(0).Cells

Dim myConnection As New SqlConnection(AppSettings(“ConnectionString”))

Dim myCommand As SqlDataAdapter

Dim myDataSet As New DataSet

myCommand = New SqlDataAdapter(“exec usp_getUsers”, myConnection)


output.Text = “processing”

If myDataSet.Tables(0).Rows.Count > 0 Then

For i = 0 To myDataSet.Tables(0).Rows.Count - 1



End If


output.Text = “processing complete”


SaveType.OpenInExcel, FileFormatType.Default, Me.Response)

End Sub

I receive this error:

Server cannot set content type after HTTP headers have been sent.

Is there another way to accomplish this?

When calling Workbook.Save method, Aspose.Cells will change the content type. So please comment out this line of code: