-
Notifications
You must be signed in to change notification settings - Fork 344
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
[Question] Conditional Formatting #315
Comments
Short answer: not yet. If you can provide me with a simplest form of a (single spreadsheet) XLSX document that has conditional formatting, I can have a look at it - I always work better with examples :) The standard seems to be clear: It's non-trivial, but I could probably make a conditional formatting object that allows you to set the properties yourself from code - it would then be your responsibility to set them properly. Something like
Unfortunately, the cfRule tag has a couple of different child elements - for starters, the only one I would support would be setting a string for the |
Thanks a lot for quick response. |
Thank you - I will have a look in the coming days. My apologies but this might take a bit as I am having a bit of trouble focusing today, and I need to sort my duties upcoming in the new year. |
NOP, please don't worry. |
Bastards... I just had a closer look and - sure enough - Microsoft is intentionally breaking the schema that they apply throughout every feature that OpenXLSX supports so far: No, multiple conditional formats are not arranged under one conditional formatting root node - instead, they create a separate "root" node per conditional formatting rule under the worksheet root node. This means a conditional formats class (like the XLCellFormats in XLStyles) can not be implemented in the same way :/ I'll have to keep access to the worksheet XML and access / create conditional format nodes from there. |
Microsoft wouldn't be Microsoft if it didn't make our life difficult :) |
Started implementing in the development-aral node: 039b9be From what LibreOffice saving an XLSX tells me, the following is true:
I put "array" in quotes, because the only way these can be grouped into an array is by XML element (tag) name, while on the same hierarchy level, elements with differing node names can be stored.
The below code can be used - for now - to change the sqref for an existing conditional formatting rule. Feel free to have a look already - or wait til I have implemented the whole thing. :)
|
I'll wait till you will finish implementation as I have something else to complete. |
Here my friend, this was a piece of work: df96485 :D But well - it's a lot of general functionality gained, so I hope it is time well invested. I might take you up on that beer offer if I ever get a chance g PS: Demo10 gives you a usage example - as mentioned in README.md |
My dear friend, Tons of thanks for great work you did. My use-case is quite simple as I already have one conditional formatting specified in my template spreadsheet and it is necessary only to apply it to all newly added rows:
It works fine at my side! PS: Please add some comment in this thread when you will release your changes so I'll switch to new release library. |
I am happy you have what you need now (though in hindsight, considering you only needed to update the sqref, I went a little overboard with the complete implementation ;) but if I do something I want to do it right). I might actually visit Armenia sometime soon - I visit Turkey a lot and wanted to see a bit of the east of the country - I wonder if they will still let me enter with an Armenian passport stamp :D |
Hi my friend, I'm sure somebody will fully use the CF functionality you added. Per me it very easy to understand and use OpenXLSX library at all, so clever developers should choose it :) There are flights from Istanbul to Yerevan and that should not be an issue for you. Another question is do you need a VISA to enter to Armenia... I can check it for you if you will let me know your country. |
@aral-matrix
Is there any possibility to specify Conditional Formatting on cell?
If no, then is it possible to retrieve Conditional Formatting from existing cell and apply it to another cell?
The text was updated successfully, but these errors were encountered: