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

Adding style as HTML table is parsed #19

Open
CarlVerret opened this issue Feb 4, 2023 · 3 comments
Open

Adding style as HTML table is parsed #19

CarlVerret opened this issue Feb 4, 2023 · 3 comments

Comments

@CarlVerret
Copy link

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.

@webdbase
Copy link

webdbase commented Apr 20, 2023

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

@CarlVerret
Copy link
Author

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.

@webdbase
Copy link

webdbase commented Jun 1, 2023

@ 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.

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