gitbrent/xlsx-js-style

Adding style as HTML table is parsed

Opened this issue · 3 comments

Hi there!

I've added style parsing to sheet_add_dom function. I'd be glad to contribute with a PR if you wish.

Only few slight changes to sheet_add_dom allow to recognize fll and text color, font weight , identation and text alignement.

Let me know if you're interested.

Do you mean that the following code:
<th>This text is bold and centred by default</th>
or
<td style="color: red; font-weight: bold;">This text is red and bold by style</td>
will appear in color and will be bold in the worksheet?

Edit:
I found it. Arround row 20982
var o = {t:'s', v:v};
should become
var o = {t:'s', v:v, s: { font: { bold: true, color: { rgb: "FF0000" } } }};
Of course s: {....} will depend on the contents of style="....." of th and td

yes, kind of. Fore and fill color, text alignement font weight (bold / italic) ...
I've been using it a lot, as our application allow export of many html tables to excel files.

@ CarlVerret
I already did it myself.
Do you know a way to format the cells? Like keep leading zeros of numbers. E.g. format them as text.