ASP.NET outputs the result into an Excel format

xiaoxiao2021-03-06  18

Private Sub WriteDataGridtoExcel () DIM FileName As String Dim FileExtName As String = ".xls" DIM STRMONTH AS STRING, STRDAY AS STRING, J AS Integer

Strmonth = cstr (Month ())) STRDAY = CSTR (day ())) for j = 1 to 2 - len (strMonth) strMonth = "0" & ​​strmonth next for j = 1 to 2 - lin StrDay = "0" & ​​strday next filename = "ensure" filename = filename & year (now ()) & strmonth & strday & fileextname 'response.write (filename)' response.end ()

Dim xlsheet As New SpreadsheetClass cnn.Open () Dim reader As SqlDataReader = Me.sql.ExecuteReader () Dim numbercols As Integer = reader.FieldCount Dim row As Integer = 2 Dim i As Integer = 0 'Output Header For i = 0 To Numbercols - 1 xlsheet.activeesheet.cells (1, i 1) = reader.getname (i) .tostring () Next

转载请注明原文地址:https://www.9cbs.com/read-45411.html

New Post(0)