Skip to content
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

The table in html can not show correctly in PDF file #1275

Closed
Lucifer-ly opened this issue Dec 20, 2020 · 1 comment
Closed

The table in html can not show correctly in PDF file #1275

Lucifer-ly opened this issue Dec 20, 2020 · 1 comment

Comments

@Lucifer-ly
Copy link

Lucifer-ly commented Dec 20, 2020

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>PDF-Download</title>

    <style type="text/css">
        table{table-layout: fixed}
        td{word-break: break-all; word-wrap: break-word; vertical-align: center}
    </style>

</head>

<body>

<h1 style="align-content: center">title</h1>
<table class="table table-bordered" border="1" align="center" bordercolor="#000000">

    <thead>
    <tr>
        <th>id</th>
        <th>protein_id</th>
        <th>sequence</th>
        <th>variant</th>
        <th>result</th>
    </tr>
    </thead>

    <tbody>
    {% for data in all_data %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ data.protein_id }}</td>
            <td style="white-space: normal" width="50%">{{ data.sequence }}</td>
            <td>{{ data.variant }}</td>
            <td>{{ data.result }}</td>
        </tr>
    {% endfor %}
    </tbody>

</table>

</body>

</html>

The data of sequence in my project is a long string, after transforming the website to PDF file,the long string can not wrap, and the whole content do not look like a table. Can anyone teach me how to fix it, thank you.

@liZe
Copy link
Member

liZe commented Dec 31, 2020

Hello.

Your table doesn’t look like at table because WeasyPrint doesn’t break your cell. We don’t support word-break yet :/, your issue is probably a duplicate of #1153.

@liZe liZe closed this as completed Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants