htmlcsshtml-tablems-word

How to get table fully copied from html to MS Word?


I'm trying to get the table in html fully copied from browser (works in Chrome) to Word document. What happens is that last row's border doesn't get passed in Word.

Take the code:

HTML:

<table id="t6">
<tr><th></th><th>raw_alpha</th><th>std.alpha</th><th>G6(smc)</th><th>average_r</th></tr>
<tr><td>gse1</td><td>0.88</td><td>0.88</td><td>0.88</td><td>0.45</td></tr>
<tr><td>gse10</td><td>0.88</td><td>0.88</td><td>0.88</td><td>0.45</td></tr>
</table>

CSS:

table, th, tr, td {
        background-color:white;
        border-spacing: 0;
        padding: 2px 6px;
        border-collapse:collapse;
        text-align: right;
    }

th {
    background-color: white;
    color: black;
    border-width:1px;
    border-color: #000;
    border-style: solid none solid none;
}

tr:last-child {
    border: 1px solid #000;
    border-style: none none solid none;
}

Is there any way to make the last row's border be included? Also is there a possibility for this to work in Firefox?


Solution

  • Borders applied to tr elements are apparently not recognized, so you need to apply them to td instead.
    In your CSS, change tr:last-child to tr:last-child td and it should work.