-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backward compatibility for write_html regarding <table> header row style #740
Comments
Hi @Mario12335. We did not rename the I'd be happy to investigate a bit more if you could provide some more detail on the error you faced. Without those crucial elements, your message is a bit incomprehensible / sounds like a baseless rant 😢 |
This is describe in newest release am I wrong? I found warnings: ignoring width="15" specified on a td that is not in the first tr. That's problem. |
OK, so this is a warning introduced in v2.7.0. It is quite self-explanatory: it means that you used a To fix this, you must simply define your table columns sizes inside the first I'd be happy to try to help you further, but you will have to provide some Python minimal code in order for me to understand what your use case is exactly 😊 By the way, this is what was recommend in the template you must have seen when you created this issue.
|
Hi @Duspy99 Unless you provide more information, I'm planning on closing this issue. |
@Lucas-C table_str = f"""
<table>
<tbody>
<tr>
<td width=15><b>Client</b></td>
<td width=100><b>{reservation.client.name}</b></td>
<td width=30><b>Status</b></td>
<td width=45 align=right>{reservation.reservation_status}</td>
</tr>
<tr>
<td width=15></td>
<td width=100></td>
<td width=30><b>Reservation #</b></td>
<td width=45 align=right>{reservation.code}</td>
</tr>
<tr>
<td width=15></td>
<td width=100></td>
<td width=30><b>Type</b></td>
<td width=45 align=right>{reservation.reservation_type.name}</td>
</tr>
</tbody>
</table>
"""
self.write_html(
table_str
) I printed output in console: <table>
<tbody>
<tr>
<td width="15"><b>Client</b></td>
<td width="100"><b>some name</b></td>
<td width="30"><b>Status</b></td>
<td width="45" align="right">some status</td>
</tr>
<tr>
<td width="15"></td>
<td width="100"></td>
<td width="30"><b>Reservation </b></td>
<td width="45" align="right">some code</td>
</tr>
<tr>
<td width="15"></td>
<td width="100"></td>
<td width="30"><b>Type</b></td>
<td width="45" align="right">some type</td>
</tr>
</tbody>
</table> |
Thank you for providing some example HTML code 😊 A self-sufficient autonomous Python script would have been ideal, from fpdf import FPDF, FPDF_VERSION
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=12)
pdf.write_html("""<table>
<tbody>
<tr>
<td width="15"><b>Client</b></td>
<td width="100"><b>some name</b></td>
<td width="30"><b>Status</b></td>
<td width="45" align="right">some status</td>
</tr>
<tr>
<td width="15"></td>
<td width="100"></td>
<td width="30"><b>Reservation </b></td>
<td width="45" align="right">some code</td>
</tr>
<tr>
<td width="15"></td>
<td width="100"></td>
<td width="30"><b>Type</b></td>
<td width="45" align="right">some type</td>
</tr>
</tbody>
</table>""")
pdf.output(f"issue_740-{FPDF_VERSION}.pdf") This is the output I get with And the output I get with I see 2 differences:
This is because you used Based on some quick tests I made using both Chrome & Firefox,
Based on those observations, I am willing to slightly change @Duspy99: do you only care about backward-compatibility in terms of visual aspect, |
It looks like a good idea to allow cells anywhere in the table to be a "header cell", and to use |
@Duspy99: I have just merged a PR that should improve backward compatibility. Could you please test it and tell us if that solves you issue?
|
FPDF.write_html() replaced with FPDF.table() ..
I got error on my live server that's reason why I open this issue.
The text was updated successfully, but these errors were encountered: