无法删除 Word 导出中表格的边框

发布于 2024-08-14 04:42:59 字数 908 浏览 1 评论 0 原文

当我将 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 的。

I'm having an issue when I export my html page to Word, I can't get rid of the borders on a table element.

<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>

I set the content type to Word

Response.ContentType = "application/vnd.ms-word";
Response.AddHeader("content-disposition", String.Concat("attachment;filename=", fileName));

No matter what I do, I still get the borders around the entire table and around each cell.

Link to picture

I've tried setting the borders attribute on the table to 0, using inline styles and including a style in a section but nothing works. I've even tried all 3 of these together.

Any ideas? This is destined for Word 2003.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

香橙ぽ 2024-08-21 04:42:59

经过大量搜索后找到了解决方法。 :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]

深海不蓝 2024-08-21 04:42:59

您是否考虑过使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文