silverlight datagrid 显示选择excel文件的内容
2个回答
展开全部
用ASPX页面 就行了,不要用银光
Private Sub excel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
With Response
.Buffer = True
.ContentType = "application/vnd.ms-excel "
.ContentEncoding = System.Text.Encoding.GetEncoding( "utf-8 ")
End With
DataGrid_CXMONEY.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
DataGrid_CXMONEY.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
end sub
GRID在放在ASPX页面上,绑定数据源
这样导出非常快,比自己递归填充XLS单元格不知道快多少.
但有个缺陷就是只能看,做统计时会有问题.
因为其实这段代码原理就是用XLS中显示HMTL而已,跟真正的XLS源代码有区别的
Private Sub excel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
With Response
.Buffer = True
.ContentType = "application/vnd.ms-excel "
.ContentEncoding = System.Text.Encoding.GetEncoding( "utf-8 ")
End With
DataGrid_CXMONEY.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
DataGrid_CXMONEY.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
end sub
GRID在放在ASPX页面上,绑定数据源
这样导出非常快,比自己递归填充XLS单元格不知道快多少.
但有个缺陷就是只能看,做统计时会有问题.
因为其实这段代码原理就是用XLS中显示HMTL而已,跟真正的XLS源代码有区别的
追问
没办法 我必须选择银光
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询