Dim workbook As New HSSFWorkbook()

        Dim sheet As HSSFSheet = workbook.CreateSheet("Sheet111")
        Dim rowItem As HSSFRow
        rowItem = sheet.CreateRow(0)
        rowItem.CreateCell(0).SetCellValue("測試資料111")

        sheet = workbook.CreateSheet("Sheet222")
        rowItem = sheet.CreateRow(0)
        rowItem.CreateCell(0).SetCellValue("測試資料222")
        rowItem.CreateCell(1).SetCellValue("測試資料222")

        sheet = workbook.CreateSheet("Sheet333")
        rowItem = sheet.CreateRow(0)
        rowItem.CreateCell(0).SetCellValue("測試資料333")

        Dim ms As MemoryStream = New MemoryStream()
        workbook.Write(ms)
        Dim file As FileStream = New FileStream("test.xls", FileMode.Create)
        Response.AddHeader("Content-Disposition", String.Format("attachment; filename=test.xls"))
        HttpContext.Current.Response.BinaryWrite(ms.ToArray())

        workbook = Nothing
        ms.Close()
        ms.Dispose()


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Roger 的頭像
    Roger

    歡迎~ 程式設計 學生 作業 專題製作 程式外包 家教...

    Roger 發表在 痞客邦 留言(0) 人氣()