【发布时间】:2009-06-18 21:32:46
【问题描述】:
我有一个 silverlight 2 应用程序,它带有一个 Datagrid 和一个用于通过返回服务器将其导出到 Excel 的按钮。
我可以创建一个表示数据网格的 HTML 字符串。我想将此字符串附加到一个 html 元素,设置 MIME type=application/vnd.ms-excel 并显示一个提示,询问我是否要打开或保存 xls 文件。
毕竟如果 ASP 可以做到这一点......
<% The main feature of this technique is that %>
<% you have to change Content type to ms-excel.%>
Response.ContentType = "application/vnd.ms-excel"
<TABLE>
<TR><TD>2</TD></TR>
<TR><TD>3</TD></TR>
<TR><TD>=SUM(A1:A2)</TD></TR>
</TABLE>
...看来我应该能够在 Silverlight 中做类似的事情,将其推送到 HTML DOM 上。
任何建议都非常感谢!
【问题讨论】:
标签: silverlight excel datagrid