用HTML 格式导出Excel 时,如何保留显示网格线 转载

来源:互联网 发布:抽烟喝酒 知乎 编辑:程序博客网 时间:2024/05/29 18:19

======================================================
注:本文源代码点此下载
======================================================

用html 格式导出excel 时,如何保留显示网格线转载

posted on 2011-05-07 12:20itcfj 阅读(454) 评论(0)编辑 收藏

用html 格式导出excel 时,如何保留显示网格线

[阅读次数:918次][发布时间:2009年11月9日]

asp.net 中

用 datagrid 的 rendercontrol 方法输出到 excel,是一种常见的办法。其本质是用 html 语法编写 excel, 表

格用 table 表示。但是默认情形下会发现 excel 的背景中的网格线(gridlines) 不显示。用什么选项可以显示网格线呢?搜索了一

下,答案是在中嵌入一段内容指示一些选项即可。

xmlns:x="urn:schemas-microsoft-com:office:excel">

");

string output = tw.tostring();

if (unformat)

{

output = regex.replace(output, @"]*>", "", regexoptions.compiled | regexoptions.ignorecase);

output = regex.replace(output, @"]*>", "", regexoptions.compiled | regexoptions.ignorecase);

}

response.write(output);

response.write("");

response.end();

hw.close();

hw.flush();

tw.close();

tw.flush();

}

绿色通道:好文要顶关注我收藏该文与我联系


======================================================
在最后,我邀请大家参加新浪APP,就是新浪免费送大家的一个空间,支持PHP+MySql,免费二级域名,免费域名绑定 这个是我邀请的地址,您通过这个链接注册即为我的好友,并获赠云豆500个,价值5元哦!短网址是http://t.cn/SXOiLh我创建的小站每天访客已经达到2000+了,每天挂广告赚50+元哦,呵呵,饭钱不愁了,\(^o^)/