Hope someone can help me with this. I have no problems saving my report to a memory stream and then sending a response to a client but I can't seem to figure out how to format the resulting spreadsheet.
Simplified version of my code is provided below. My question is where in this code will I insert formatting statements for the worksheet and what those statements will be. I was hoping that after I import tblExcel table to cells collection of my worksheet I will be able to loop through rows and columns of that worksheet and assign an appropriate style to a cell but after ImportDataTable command has been executed and I look at cellsRpt.Columns.Count or cellsRpt.Rows.Count properties I get a zero in both cases. cellsRpt.Count, however returns the right number of cells. I can format the content of tblExcel table but thet all my numeric values become strings. If anyone have come into a problem like this or has some insight, please point me in the right direction.
Dim excelObj As New Excel
Dim cellsRpt As Cells = excelObj.Worksheets(0).Cells
< produces table tblExcel >>
cellsRpt.ImportDataTable(tblExcel, True, "A1")
Try
excelObj.Save(memStream, FileFormatType.Default)
Response.ClearHeaders()
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "inline; filename=report.xls")
Response.BinaryWrite(memStream.ToArray)
Response.End()