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

How to preserve border-bottom without table #231

Open
jjikkobro opened this issue Jan 1, 2024 · 0 comments
Open

How to preserve border-bottom without table #231

jjikkobro opened this issue Jan 1, 2024 · 0 comments

Comments

@jjikkobro
Copy link

Hello, I am currently exploring various libraries to implement a feature that converts HTML to DOCX for download. Most of the HTML, PDF to DOCX libraries fail to properly convert design formats like the one shown in the picture below with

. To escape this, I tried using tricks such as replacing it with elements, but this approach results in displaying borders on all four sides, unintentionally constraining the content to a table format. Is there a way to fully convert the following HTML into a DOCX document without these issues?

origin html

<style>
    body { font-family: Arial, sans-serif; }
    .resume { width: 100%; padding: 20px;}
    .header { display: flex; border-bottom: 3px solid;}
    .header h1 { text-align: left;}
    .header p { text-align: right; margin-left: auto;}
    .summary {text-align: left; margin: 20px 0 20px 0; border-bottom: 3px solid; padding-bottom: 20px;}
    .various-section {display: flex; margin-bottom: 20px}
    .various-section-title { flex: 0 0 150px; text-align: left; font-weight: bold; margin-right: 10px;}
    .various-section-item { text-align: left; flex: 1; }
</style>

tried html

    <style>
        body { font-family: Arial, sans-serif; }
        .resume { width: 100%; padding: 20px; border-collapse: collapse; }
        .header, .summary, .various-section { display: flex; }
        .header-row, .summary-row, .section-row { border-bottom: 3px solid; }
        .header h1 { text-align: left; }
        .header p { text-align: right; margin-left: auto; }
        .summary { text-align: left; margin: 20px 0; padding-bottom: 20px; }
        .various-section-title { flex: 0 0 150px; text-align: left; font-weight: bold; margin-right: 10px; }
        .various-section-item { text-align: left; flex: 1; }
        td { border: none; }
    </style>
</head>
<body>
    <table class="resume">
        <tr class="header-row">
            <td colspan="2">
                <div class="header">
                    <h1>I.M.A. SAMPLE II</h1>
                    <p>4321 South 55 Street<br>Bellevue, Nebraska 68005<br>(402) 291-5432<br>[email protected]</p>
                </div>
            </td>
        </tr>
        <tr class="summary-row">
            <td colspan="2">
                <div class="summary">
                    <span style="font-weight: bold;">OBJECTIVE:</span>
                    <span>Internship or Part-time Position in Marketing...</span>
                </div>
            </td>
        </tr>

html

image

docx

image

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

1 participant