Using cfdocument to generate PDF
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. Th开发者_如何学Pythone 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.
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>
精彩评论