从 HTML 页面转换为 MS Word 2003 时,表格边框无法正确显示

发布于 2024-08-26 16:53:23 字数 361 浏览 2 评论 0原文

我的设置有点复杂。我专门研究为第 3 方系统编写的 XSLT。所有 CSS 在浏览器中看起来都很好。现在,该系统提供了一个按钮,可以将我生成的 HTML 转换为 MS Word 2003。

但是,表格边框不会像浏览器中显示的那样进行转换。有很多桌子,它们有不同的边框设置。例如,有一个仅使用外部边框,内部没有边框。转换为 MS Word 时,会出现一个表格,单元格之间有所有边框。这是我不想要的。

我尝试在互联网上搜索,但没有发现任何有用的信息。也许有关于如何设置表格边框的提示或技巧,以便 MS Word 能够正确理解。

第三方表示:“系统只是传递通过在已安装的 Word 版本中找到的转换器创建的 HTML”。

我真的很感激任何提示和帮助!

I've got a bit of a complicated set up. I specialise in XSLT which I write for 3rd party system. All CSS looks fine in the browser. Now that system provides a button that converts my generated HTML into MS Word 2003.

However, table borders don't convert as they appear in a Browser. There are lots of tables and they have different borders setup. For example there is one that uses only outside border and no borders inside it. When converting to MS Word, a table appears with ALL the borders in between cells. Which I don't want.

I've tried search the Internet, but didn't come across anything useful. Maybe there are tips or tricks on how to set up tables borders so it's understood properly by MS Word.

The third party said the following: "The system just passes the HTML created through the converter it finds in the installed version of Word".

I would really appreciate any tips and help!

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

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

发布评论

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

评论(3

被翻牌 2024-09-02 16:53:23

这是您需要的:

<table border=1 cellspacing=0 cellpadding=0 
       style='border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;'>
...
</table>

Here is what you need:

<table border=1 cellspacing=0 cellpadding=0 
       style='border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;'>
...
</table>
小…红帽 2024-09-02 16:53:23

我试图获得一张只有外边框而没有内边框的表格。我一直在尝试以下 HTML:

但是,在 Word 中,该表格同时显示外边框和内边框,而不仅仅是我试图获取的外边框。

嗯,这就是 border 的作用。唔。你说内联 CSS 没有被拾取,所以我猜这两个:

 <table style="border: 1px black solid" ....>

或者用

包围表格

 <div style="border: 1px black solid"><table .....></table></div>

都不起作用?这些将是最优雅的解决方案。

如果这一切都失败了,为什么不把表放到表中呢?

<table border="1" bordercolor="black" cellspacing="0" cellpadding="0">
 <tr><td>
  <table .... Your table  ........> </table>
 </td></tr>
</table>    

从网页设计的角度来看,在 2010 年使用这种做法是一种可怕的做法,但如果这是唯一的解决方法,以便您可以正确导入页面,也许这是必要的。不过,我非常确定某些形式的CSS必须能够工作。也许是不同的符号或其他什么。但我不是 Word HTML 专家。

I was trying to get a table with only the outer border and no inside ones. I've been trying the following HTML:

<table border="1" frame="border" rules="none" cellpadding="4" cellspacing="0">

However, in the Word that table appears with both outer and inner borders, not just with outer border as I was trying to get it.

Well, that is what border does. Hmm. You say inline CSS doesn't get picked up, so I guess both this:

 <table style="border: 1px black solid" ....>

or surrounding the table with a <div>

 <div style="border: 1px black solid"><table .....></table></div>

won't work? Those would be the most elegant solutions.

If all that fails, why not put the table into a table?

<table border="1" bordercolor="black" cellspacing="0" cellpadding="0">
 <tr><td>
  <table .... Your table  ........> </table>
 </td></tr>
</table>    

it's a horrible practice to use in 2010 from a web design point of view, but if it's the only workaround so you can import the page correctly, maybe it's necessary. I'm pretty sure however that some form of CSS must work. Maybe a different notation or something. But I'm no Word HTML expert.

和影子一齐双人舞 2024-09-02 16:53:23

也许如果您按照您希望的方式在 Word 中设置表格,然后将其导出为 html 文件。然后将其重新导入到 Word 中以查看其是否正常工作。然后将 html 文件中的样式结构应用到 CSS/HTML 生成系统。

Perhaps if you setup the tables how you would like it in word and then export this as an html file. Then import this back into word to see it works correctly. Then apply the style structure from your html file to your CSS/HTML generation system.

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