Comments (7)
I'm interested in this feature. I started working on it in my fork (progress so far), but I have a couple of questions.
-
Generally speaking, I added ConditionalFormatting and ConditionalFormattingRule classes, and a add_conditional_formatting function to Worksheet. Is that in line with what you'd do?
-
I tried to add validators to check types of things against what's in the spec. Have you just been going off of MSDN? http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.conditionalformattingrule.aspx
-
I got the conditionalFormatting blocks to generate correctly, but I can't get the styling piece added to the stylesheet. I'm not entirely sure what a
dxfId
is - it seems like it's the index into the<dxfs>
block in the stylesheet. Is there any way for me to create styles that get put inside that block with the current style code? You have a@dxfs
variable but 1) doesn't seem like it ever gets set and 2) The to_xml code wouldn't seem to generate sub-blocks of<dxf></dxf>
from it.
As an example, here's what Excel on Mac generates (closing </cellStyles>
tag just to show position)
</cellStyles><dxfs count="3"><dxf><font><color rgb="FF9C0006"/></font>
<fill><patternFill><bgColor rgb="FFFFFFFF"/></patternFill></fill>
</dxf></dxfs>
from axlsx.
@scpike woot!
That is a big chunk of love!
RE: 1) Absolutely perfect.
-
I always use the Office Open XML spec
http://dl.dropbox.com/u/52469356/ECMA-376.1.zip -
You are quite correct that we have not implemented xdf yet. That is the missing piece!
18.8.14 dxf (Formatting) in the spec.
It is basically a container node for
alignment (Alignment) (§18.8.1)
border (Border) (§18.8.4)
fill (Fill)(§18.8.20)
font (Font)(§18.8.22)
numFmt (Number Format)(§18.8.30)
protection (Protection Properties)(§18.8.33)
Models for all of those objects are already in the stylesheet directory, I just never got around to making a dxf class :(
The last step would be adding adding an option for add_style to mark the style as differential and return the dxfs index so when you create your conditional_formatting_rule, you have an dxfId.
In the mean time, please send in a pull request for your stuff!
I'll merge it in and add you to the contributors list so you can code directly against master.
from axlsx.
I did some more work on this today, and Dxf elements now exist. I think all the commits got automatically added to the pull request I sent earlier.
I did a bunch of messing around with Styles#add_style so that styles for Xf elements continue to get put inside @numFmts
, @fills
, @fonts
, etc. while Dxf styles don't (they only get put inline in the <dxf>
chunks. It still passes all your tests and I added some for dxfs, but you should take a look at the changes there before you merge it in in case we want to do some re-factoring.
With the most recent commits I'm able to create .xlsx files with working conditional formatting (see examples/example_conditional_formatting.rb). We're still missing support for dataBar, colorScale, and iconSet child elements of ConditionalFormattingRule, which aren't that important to me.
from axlsx.
@scpike This is really great work mate. You now have full access to the repo so when you run into something you want, please don't hesitate to add it in. I am really impressed with the quality of your work. I've set you up with direct access to the repo. If you ever have any questions you can usually find me lurking in #axlsx (the ci environment for this gem reports there) or #travisci on freenode.
I just plugged in colorScale and will knock off dataBar and iconSet today as well so we can call it done (until someone reports a bug of course!)
That Style#add_style method does indeed need a bit of love - but I am so impressed with this I think I'll release it next week with a blog post! Let me know your twitter handle if you have one.
from axlsx.
It is all implemented - but we need some testing help!
After spending a few hours to build in icon set, data bar and color scale - only to find out that my crappy 2007 Mac version tells me very politely that it does not support those conditional formats. Any out there have a windows version handy to do some testing? No validation errors or fix errors so the data should be clean - just cant verify if it actually works...
from axlsx.
@randym Thanks for the compliment, you really know who to make a guy want to contribute!
I have Excel for Mac 2011, which supports icon set, data bar, and color scale. They worked with no errors, but the Icon set showed all green lights. I modified IconSet#initial_value_objects to have three based on percentages, so our default now matches the example in 18.3.1.49, and got a much nicer looking thing.
from axlsx.
That is AWESOME!
from axlsx.
Related Issues (20)
- Some formulas do not work in Axlsx
- Title not set in LineChart.
- Mutiple thread error file HOT 2
- Conditionnal formating
- Upgrade Rubyzip 2 HOT 6
- outline_level_rows bag
- Stacked bar chart plotted as staircased HOT 3
- formula1 dont work on add_data_validation HOT 1
- Numbers as text HOT 1
- Low-order non-printable ASCII characters in worksheet name should be escaped or removed HOT 5
- Performance reduction with rails 5.2 HOT 2
- undefined method `downcase' when call the serialize method HOT 2
- rubyzip dependency is old
- Deployment not working (mimemagic (0.3.0) - version could not be found HOT 5
- dependent drop-down list
- Axlsx indent not working HOT 1
- DropDownList selected NAME get ID
- can't modify frozen String when run with --enable=frozen-string-literal flag HOT 1
- Stacked bar chart example not working HOT 1
- Error when opening xlsx file from OneDrive but not from other programs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axlsx.