Free Support Forum - aspose.com

ASP.NET Save Corrupted File

All…

I’m using the following code snippet to generate an XLS file and download to the browser… it works fine up to about 3000 rows or so… then when trying to open the file in Excel, it states there were too many errors in the file and aborts…

oCells.ImportDataTable(dt, True, 0, 0, CType(Me.txtRows.Text, Integer), 50)
oAP.Save(cOutput, FileFormatType.ExcelXP)

If System.IO.File.Exists(cOutput) Then
Response.ClearContent()
Response.ClearHeaders()
Response.BufferOutput = True
If Me.rbEXP_ByAccount.Checked Then
Response.AddHeader(“content-disposition”, “attachment;filename=HoldingsByAccount.XLS”)
Else
Response.AddHeader(“content-disposition”, “attachment;filename=HoldingsByRep.XLS”)
End If
Response.ContentType = “text/filedown”
Response.WriteFile(cOutput)
Response.Flush()
Response.Close()
End If

any help would be appreciated…

Thanks
Scott


Dear Scott,

Would like to email us a completely working test case ( including data) which can reproduce the errors?

Thanks for your cooperation.