使用cfdocument生成PDF

发布于 2024-09-28 11:26:24 字数 870 浏览 2 评论 0原文

实际的表格比我要向您展示的模型大很多,但这个模型确实解释了问题。请前往http://www.monteandjanicechan.com/test_table.cfm

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

这让我相信一个单元格的背景颜色以某种方式转移到它旁边的单元格并覆盖边框。以下是奇怪的事情:

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

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

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

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

The actual table is a lot larger than the mock-up one that I am going to show you but this mock-up one does explain the problem. Please go to http://www.monteandjanicechan.com/test_table.cfm

The thickness of the grid lines in the table are coming up the way I want in the HTML version. You can do a View Source to see the actual HTML stuff that gets generated. Now, I put these HTMl codes within the cfdocument tag with format="pdf"; please go to http://www.monteandjanicechan.com/test_table_pdf.cfm. You will see the inconsistent thickness of the grid line for sneezing and for flu. To further illustrate my point, I removed the background colors and generate a PDF; please go to http://www.monteandjanicechan.com/test_table_pdf_nocolor.cfm. The thickness of the grid lines is back to normal.

This leads me to believe that the background color of one cell somehow goes over to the cell right next to it and cover up the border. Here are the strange things:

1) This is ONLY happening in rowspan and ONLY happening from the second row on to the rest of the rowspan. For example, first Sneezing is okay but the border of the second sneezing is not correct; the first Flu is okay but the borders of the second and the third Flu are not correct.

2) The background color does NOT cover the border of its own cell at all; it only cover the border of the cell right next to it.

My question is, how can I fix this issue?

Any suggestions and pointers are greatly appreciated.

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

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

发布评论

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

评论(1

你曾走过我的故事 2024-10-05 11:26:24

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>

The thickness varies in the HTML version as well. I think the problem is with your CSS rules.

This works how I think you want, although it could probably be improved.

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