The following code is not working:
Try
Dim workbook = New HSSFWorkbook()
Dim sheet As HSSFSheet = workbook.CreateSheet("Sheet1")
Dim row As HSSFRow = sheet.CreateRow(0)
row.CreateCell(0).SetCellValue("Cell1")
End Try
I am getting "ex = {Unable to evaluate expression.}"
Please help
Try
Dim workbook = New HSSFWorkbook()
Dim sheet As HSSFSheet = workbook.CreateSheet("Sheet1")
Dim row As HSSFRow = sheet.CreateRow(0)
row.CreateCell(0).SetCellValue("Cell1")
Using ms As New MemoryStream()
workbook.Write(ms)
Dim saveAsFileName As String = String.Format("Export-{0:d}.xls", DateTime.Now).Replace("/", "-")
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", saveAsFileName))
Response.Clear()
Response.BinaryWrite(ms.GetBuffer())
Response.End()
End Using
Catch ex As ExceptionEnd Try
I am getting "ex = {Unable to evaluate expression.}"
Please help