Open
Conversation
Closed
Member
francoisfreitag
left a comment
There was a problem hiding this comment.
Supporting style attributes on cells is a good addition. Perhaps styles could even be defined on thead, tbody, tr, and merged with their descendant to compute the final style. Basically, something like:
<table>
<tr style="color: blue; background: green;">
<td>Blue text on green background</td>
<td style="color: black;">Black text on green background</td>
<td style="color: black; background: white">Black text on white background</td>
</tr>
</table>Just an idea.
Comment on lines
+148
to
+151
| if header and row == 0: | ||
| for p in cell.paragraphs: | ||
| for r in p.runs: | ||
| r.font.bold = True |
Member
There was a problem hiding this comment.
I do not think everybody wants to have their header row in bold style. However, it would be great to support font-weight as a style attribute or the <b> markup.
Comment on lines
+302
to
+304
| styles = [b for a, b in attrs if a == "style" and b] | ||
| if styles: | ||
| self.style = styles[0] |
Member
There was a problem hiding this comment.
Can use the get_attr helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
note that this includes PR 55. I have a patience problem..
so I was wondering if you'd like to include something like the last commit here: we take the "style" attribute from table cells and use it to set fore- and background color for each cell (I didn't bother to write any tests yet).
it would be nicer of course to also get styling from CSS if there, but I couldn't quickly find a nice CSS 'resolver' (?), to get the style for each individual HTML element.
cheers.