无法从Word导出中的表中删除边框 [英] Can't remove borders from tables in Word export

查看:106
本文介绍了无法从Word导出中的表中删除边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将我的HTML页面导出到Word时,出现了问题,我无法摆脱表格元素上的边框。

 < table cellspacing =0cellpadding =0> 
< tr>
< td class =title>分析师< / td>
< td>
< asp:Label ID =lblAnalystrunat =serverCssClass =data/>
< / td>
< td class =title>借款人< / td>
< td>
< asp:Label ID =lblBorrowerrunat =server/>
< / td>
< / tr>
< / table>

我将内容类型设置为Word

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

无论我做什么,我仍然可以在整个表格周围以及每个单元格周围获得边框。 / p>



我尝试将表格上的边框属性设置为0,使用内联样式并在节中包含样式,但没有任何效果。我甚至一起尝试了所有3种。

有什么想法?这是注定要用于Word 2003的。

解决方案

您是否考虑过使用WordML而不是普通的旧HTML? Word对于如何导入HTML非常奇怪。



我的建议是从HTML中导出Word表格,并精确模仿HTML 。很有可能,它会涉及样式表类的一些时髦命名和一小部分特定于Word的CSS指令。


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.

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.

解决方案

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.

这篇关于无法从Word导出中的表中删除边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆