【问题标题】:Table content getting cutoff when converted from HTML page into MS Word 2003从 HTML 页面转换为 MS Word 2003 时表格内容被截断
【发布时间】:2017-01-09 09:48:39
【问题描述】:

当从 HTML 页面转换到 MS Word 2003 时,表格内容在页面右侧被截断。下面给出了一个示例 html(其中占位符 $CLOB_DATA 将被大 CLOB 数据替换):

<html>
    <body>
        <table width="80%" border="0">
            <tr>
                <td> Details: </td>
                <td> $CLOB_DATA </td>
            </tr>
        </table>
    </body>
</html>

测试word文档的屏幕截图(从上面的HTML代码转换而来)如下:

请帮我把文字调整到页面上。我给 table 和 td 标签提供了固定宽度、分词样式,但它在 word 文档中不起作用。

【问题讨论】:

    标签: html css ms-word html-table


    【解决方案1】:

    你可以试试word-break: break-word;

    body, table.body, td, th {
        word-break: break-word;
    }
    

    这应该可以解决问题

    【讨论】:

    • 我试过这个。但是它在 word doc 中不起作用。
    【解决方案2】:

    我已经解决了这个问题。在 html 标头部分使用 w:DontGrowAutofit(word XML 元素)。

    <html xmlns:w="urn:schemas-microsoft-com:office:word">
    <head>
        <!--[if gte mso 9]>
        <xml>
            <w:WordDocument>
                <w:Compatibility>
                    <w:DontGrowAutofit/>
                </w:Compatibility>
            </w:WordDocument>
        </xml>
        <![endif]-->
    </head>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多