无法删除 Word 导出中表格的边框
当我将 html 页面导出到 Word 时遇到问题,我无法去掉表格元素上的边框。
<table cellspacing="0" cellpadding="0">
<tr>
<td class="title">Analyst</td>
<td>
<asp:Label ID="lblAnalyst" runat="server" CssClass="data" />
</td>
<td class="title">Borrower</td>
<td>
<asp:Label ID="lblBorrower" runat="server" />
</td>
</tr>
</table>
我将内容类型设置为 Word
Response.ContentType = "application/vnd.ms-word";
Response.AddHeader("content-disposition", String.Concat("attachment;filename=", fileName));
无论我做什么,我仍然会看到整个表格和每个单元格周围的边框。
我尝试使用内联样式将表格上的边框属性设置为 0并在一个部分中包含一种样式,但没有任何效果。我什至已经尝试过所有这三个。
有什么想法吗?这是针对 Word 2003 的。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过大量搜索后找到了解决方法。 :D
将 table 更改为
border="1" style="border: 1px whitesolid" cellspacing="0" cellpadding="0" >
然后在每个td上提供内联样式(或给出一个类)并添加以下样式
边框:1px白色实心
就这样。你已经完成了:)
/* John JB */
[电子邮件受保护]
Got a workaround after searchin a lot. :D
Change the table as
<table border="1" style="border: 1px white solid" cellspacing="0" cellpadding="0" >
then on each td provide inline style(or give a class) and add the following style
border: 1px white solid
Thats all. You are done :)
/* John JB */
[email protected]
您是否考虑过使用 WordML 而不是普通的旧式 HTML? Word 导入 HTML 的方式非常奇怪。
我的建议是从 HTML 格式的 Word 导出表格,并精确模仿该 HTML。很有可能,它将涉及样式表类的一些时髦命名和一小部分特定于 Word 的 CSS 指令。
Have you considered using WordML rather than plain old HTML? Word is incredibly weird about how it imports HTML.
My suggestion would be to export a table from Word in HTML, and mimic that HTML precisely. Chances are, it will involve some funky naming for stylesheet classes and a small army of Word-specific CSS directives.