我将DataGrid的数据导入Excel中后,我想让其中某些列的不导入Excel中,怎么做呢?(即datagrid中显示,而在excel中某些列让其不显示)
谢谢
谢谢
解决方案 »
- Cookies跳转页面消失了?
- GridView做报表导入Office代码应该怎么写啊?
- 高手显身 抽空帮帮我 万分感谢 项目在即
- 域名和空间
- 哪位朋友用.net做过语音的事例
- ASP.NET 2.0中的SqlDataSource如何动态执行SQL?如何用代码给其SQL语句的参数进行赋值?
- 问题:无法打开宏储存
- 怎样合并DataGrid表头,在线等待
- sql2000客户端sa无法登陆?听说是身份验证的问题么?
- IE里打回车,除了执行PAGELOAD里的事件外,还执行下一个有事件的按钮中的事件,我想不让它执行可不可以?怎么做啊?哪位大哥指导一下,谢谢!
- 推荐: .net中ftp支持,建议置顶
- ViewState的初始化问题
Dim com As New OleDbCommand("SELECT * FROM " & strTableName & " Where 0=0" & strsqlcon, cnn)
Dim dr As OleDbDataReader
Dim strFilePath As String
strFilePath = Request.MapPath("..")
strFilePath += "\cache\" & strTableComment & ".csv"
If IO.File.Exists(strFilePath) Then
Try
IO.File.Delete(strFilePath)
Catch ex As Exception
End Try
End If Dim excelFile As New IO.StreamWriter(strFilePath, False, System.Text.Encoding.Default)
Dim sHttpFileName As String
Dim iRow, iCol As Integer
iRow = 1
Try
cnn.Open()
dr = com.ExecuteReader Dim strTitle As String
For iCol = 1 To dr.FieldCount
strTitle = strTitle & funGetFieldName(dr.GetName(iCol - 1), strTableName) & ","
'myWorkSheet.Cells(iRow, iCol) = dr.GetName(iCol - 1)
Next
excelFile.WriteLine(strTitle)
iRow += 1
Dim strText As String Do While dr.Read
For iCol = 1 To dr.FieldCount
strText = strText & dr.Item(iCol - 1) & ","
Next
excelFile.WriteLine(strText)
strText = ""
iRow += 1
Loop Try
excelFile.Flush()
excelFile.Close()
Finally
End Try Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "text/csv"
Response.AddHeader("Content-Disposition:", "attachment; filename=" & HttpUtility.UrlEncode(strFilePath))
Try
Response.WriteFile(strFilePath)
Response.Flush()
Response.Close()
Response.End()
Call subLog("结构化数据", "导出" & strTableComment & "为Excel!", strJH)
Catch ex As Exception
Response.Redirect("../error/szjt_cw.htm")
End Try Catch ex As Exception
Response.Redirect("../error/szjt_cw.htm")
Finally
dr.Close()
'dr.Dispose()
com.Dispose()
cnn.Close()
cnn.Dispose()
End Try