[英]How to export Type DataTable (TVP) to a .csv or .xls file?
I want to export TVP (Type of DataTable) to .csv file, or .xls, but more to .csv using aspx. 我想将TVP(DataTable类型)导出到.csv文件或.xls,但更多的是使用aspx导出到.csv。 Can you help me with this questuion? 你能帮我解决这个问题吗?
There is a lot of ways by which you can achieve this. 有很多方法可以实现这一目标。 Just take a look into my blog . 只需看看我的博客 。 I specified 3 ways of doing it in my article. 我在文章中指定了3种方法。
These are the ways of doing it without using the Interop. 这些是不使用Interop的方法。
How to format my data during export time, for example color rows, columns, headers and so on. 如何在导出期间格式化我的数据,例如颜色行,列,标题等。
For this, I would like to quote these from my blog. 为此,我想从我的博客中引用这些内容。
RenderControl RenderControl
Using this approach, we can easily export the data from GridView. 使用这种方法,我们可以轻松地从GridView导出数据。 This will be useful when we want our exported data in the same format as in the GridView. 当我们希望导出的数据格式与GridView中的格式相同时,这将非常有用。
Format your grid as required and invoke its RenderControl
method. 根据需要格式化网格并调用其RenderControl
方法。 This will export style along with the data. 这将导出样式和数据。
HTML Table HTML表格
Here the sheets are treated as a html table. 这里的表被视为html表。 The advantage of this approach is easy customization. 这种方法的优点是易于定制。 You can customize the output using any html tags. 您可以使用任何html标记自定义输出。
Wrap data
with html style elements
and render it. 用html style elements
包装data
并渲染它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.