1

实际的桌子比我要给你看的模型大很多,但是这个模型确实解释了这个问题。请访问http://www.monteandjanicechan.com/test_table.cfm

表格中网格线的粗细正以我在 HTML 版本中想要的方式出现。您可以查看源代码来查看生成的实际 HTML 内容。现在,我将这些 HTML 代码放在 cfdocument 标记中,格式为 format="pdf"; 请访问http://www.monteandjanicechan.com/test_table_pdf.cfm。您会看到打喷嚏和流感的网格线粗细不一致。为了进一步说明我的观点,我删除了背景颜色并生成了 PDF;请访问http://www.monteandjanicechan.com/test_table_pdf_nocolor.cfm。网格线的粗细恢复正常。

这让我相信一个单元格的背景颜色不知何故会转到它旁边的单元格并覆盖边界。以下是奇怪的事情:

1)这仅发生在行跨度中,并且仅发生在从第二行到行跨度的其余部分。例如,第一次打喷嚏可以,但第二次打喷嚏的边界不正确;第一次流感还可以,但第二次和第三次流感的边界不正确。

2) 背景颜色完全不覆盖自身单元格的边框;它只覆盖它旁边的单元格的边界。

我的问题是,我该如何解决这个问题?

非常感谢任何建议和指示。

4

1 回答 1

1

HTML 版本的粗细也有所不同。我认为问题在于您的 CSS 规则。

这可以按照我的想法工作,尽管它可能会得到改进。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Test Table</title>
    <style type="text/css">
    td { 
        border-top: 1px solid black; 
        border-left: 1px solid black; 
    }
    .right { border-right: 1px solid black; }
    .bottom {border-bottom: 1px solid black; }
    </style>
  </head>
  <body>
<table border="0" cellspacing="0" cellpadding="5">
  <tr>

    <td class="a_style">Name</td>
    <td class="a_style">Problem</td>
    <td class="right">Treatment</td>
  </tr>
  <tr>
    <td class="b_first">Jane Doe</td>
    <td class="c_first" style="background-color:#ffff99">Cough</td>

    <td class="right" style="background-color:#ffff99">Vitamins</td>
  </tr>
  <tr>
    <td class="b">John Doe</td>
    <td class="c" style="background-color:#99FF99">Sneezing</td>
    <td class="right" rowspan="2" style="background-color:#99FF99">Nose Spray</td>
  </tr>

  <tr>
    <td class="b">Joe Schmo</td>
    <td class="" style="background-color:#99FF99">Sneezing</td>
  </tr>
  <tr>
    <td class="b">Joe Six Pack</td>
    <td class="c" style="background-color:#cccccc">Flu</td>

    <td class="right bottom" rowspan="3" style="background-color:#cccccc">Flu Shot</td>
  </tr>
  <tr>
    <td class="b">Joe The Plumber</td>
    <td class="" style="background-color:#cccccc">Flu</td>
  </tr>
  <tr>

    <td class="bottom">Joe Doe</td>
    <td class="bottom" style="background-color:#cccccc">Flu</td>
  </tr>
</table>
</body>
</html>
于 2010-10-20T16:03:34.083 回答