【发布时间】:2011-05-04 06:30:30
【问题描述】:
我通过将数据作为 HTML 表格字符串发送并设置内容标题来将 HTML 表格导出到 Excel:
Dim html as String = "<table><tr><td>example<td></tr></table>"
context.Response.Clear()
context.Response.AddHeader("Content-Disposition", "attachment; filename=" & "exceldata-" & Now.ToString("yyyyMMddHHmmss") & ".xls")
'context.Response.AddHeader("Content-Length", ????)
context.Response.ContentType = "application/octet-stream"
context.Response.Write(response)
context.Response.End()
有没有一种简单的方法可以根据 html 字符串的大小来设置内容长度?还是我应该把它留空...如果有理想的内容长度会很好...
我在 asp.net 中使用 GenericHandler 返回这个
【问题讨论】:
标签: asp.net html http-headers httpresponse