我正在尝试使用以下方法将一些HTML内容转换为MS word,但我试图设置为表行的一些样式(如边框-底部)在转换后的word文档中根本看不到。有人能帮帮我吗?
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<body>
<table>
<tr style="border-bottom:2pt solid #AFAFAF">
<td>One</td>
<td>1</td>
</tr>
<tr style="border-bottom:2pt solid #AFAFAF">
<td>One</td>
<td>1</td>
</tr>
</table>
</body>
</html>我甚至尝试过设置style="mso-border-bottom-alt: solid #AFAFAF 2pt;",但也不起作用。我的要求是非常明确的,我应该有每一行的底部边界。
发布于 2021-11-23 17:30:22
正如Azu所提到的,在<table>上使用cellspacing="0"时,将border- by设置为<td>而不是<tr>标记确实起到了作用。
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<body>
<table width="100%" cellspacing="0">
<tr>
<td style="border-bottom:2pt solid #AFAFAF">One</td>
<td style="border-bottom:2pt solid #AFAFAF">1</td>
</tr>
<tr>
<td style="border-bottom:2pt solid #AFAFAF">One</td>
<td style="border-bottom:2pt solid #AFAFAF">1</td>
</tr>
</table>
</body>
</html>https://stackoverflow.com/questions/70084768
复制相似问题