-
-
Notifications
You must be signed in to change notification settings - Fork 637
Conversation
Verified that @madflow has signed the CLA. Thanks for the pull request! |
@madflow you just made my day with this comment:
|
@@ -61,6 +62,13 @@ class Style | |||
/** @var bool Whether the wrap text property was set */ | |||
protected $hasSetWrapText = false; | |||
|
|||
/** @var string Background color */ | |||
protected $backgroundColor = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be set to self::DEFAULT_BACKGROUND_COLOR instead of null?
7fb22e4
to
8c64e64
Compare
@@ -125,7 +125,7 @@ The writer always generate CSV files encoded in UTF-8, with a BOM. | |||
|
|||
#### Row styling | |||
|
|||
It is possible to apply some formatting options to a row. Spout supports fonts as well as alignment styles. | |||
It is possible to apply some formatting options to a row. Spout supports fonts, background as well as alignment styles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll have to rebase and resolve the conflicts with borders
58954d7
to
46619c7
Compare
@adrilo Thanks for your support. I rebased and merged the current upstream. I agree - we should use "best practice / reusing common parts" for the This PR does turn out to be more than a quick afterwork hack - so I would appreciate any tips and pushes to the PR branch. |
It turns out, XLSX seems to preserve two "no background" definitions. I have a hard time finding the actual specification for this... No luck yet. But LibreOffice does it and openpyxl and probably everyone else.
I'll amend the PR. I guess I will use |
I don't think there's a spec for that. The spec will describe how |
Regarding the reuse of the In This is high level but hopefully it can help. BTW, you can do this in another PR, as the changes involved may be tricky |
46619c7
to
dd56f46
Compare
This one is getting very stale :/ I commited and pushed the latest changes. My first approach was to amend the AbstractHelper class - but when I was finished I decided that it should got into the XLSX StyleHelper... Considering, that fonts and borders are both not re-using definitions in the XLSX world at the moment, this seemed correct. There should be more to come.
I am not perfectly happy how it looks at the moment - but it adds imediate business value. (background colors 💃 ) The test code I used for quick copy+paste: |
// The other fills are actually registered by setting a background color | ||
foreach ($this->registeredFills as $styleId) { | ||
|
||
/** @var $style Style */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be /** @var Style $style */
👍 This looks great! Now regarding your comments:
Feel free to do it now or later. I'm comfortable pushing your changes as is.
Sounds good!
Yeah I guess that's fine. Another way to do it is to store the "pattern" and "fgcolor" attributes in an array inside Thanks again for this pull request! I'll merge it whenever you tell me you're done with it. |
2b024d2
to
9ae0190
Compare
I have pushed the changes, squashed the commits and rebased. |
Sorry, I just merged a new commit. I did not see you had pushed a new commit... Can you rebase one more time please? BTW do you know if I can do it for you? It's annoying to have to ask you every time... |
9ae0190
to
910676d
Compare
Removed default background color, cosmetics Remove default background color reuse bg colors Cosmetics Moved reusing fills to XLSX StyleHelper Tests and inline doc
No - problem - I just rebased. I do not think that it is possible as a "Hub" feature. I can give your write access to my fork - but than you would be just doing my work. But - not 100% sure. Would be interesting to know! |
Thanks again @madflow ! |
This is loosely related to #182. This PR introduces setting a background color to the styles definition.
patternType
constants (http://www.officeopenxml.com/SSstyles.php, darkGrid, lightTrellis) - these are ignored.