diff options
| -rw-r--r-- | README.md | 17 | ||||
| -rwxr-xr-x | examples/example.rb | 64 | ||||
| -rw-r--r-- | lib/axlsx/version.rb | 2 |
3 files changed, 75 insertions, 8 deletions
@@ -17,7 +17,7 @@ Axlsx: Office Open XML Spreadsheet Generation **License**: MIT License -**Latest Version**: 1.1.7 +**Latest Version**: 1.1.8 **Ruby Version**: 1.8.7, 1.9.2, 1.9.3 @@ -25,7 +25,7 @@ Axlsx: Office Open XML Spreadsheet Generation **Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head. -**Release Date**: June 11th 2012 +**Release Date**: July 14th 2012 If you are working in rails, or with active record see: http://github.com/randym/acts_as_xlsx @@ -70,8 +70,6 @@ Feature List **10. Support for formulas, merging, row and column outlining as well as cell level input data validation. -**11. Support for cell merging as well as column and row outline - **12. Auto filtering tables with worksheet.auto_filter as well as support for Tables **13. Export using shared strings or inline strings so we can inter-op with iWork Numbers (sans charts for now). @@ -82,6 +80,9 @@ cell level input data validation. **16. Support for password and non password based sheet protection. +**17. First stage interoperability support for GoogleDocs, LibraOffice, +and Numbers + Installing ---------- @@ -114,13 +115,15 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem, #Change log --------- -- **July.??.12**: 1.1.8 release +- **July.14.12**: 1.1.8 release + - added html entity encoding for sheet names. This allows you to use + characters like '<' and '&' in your sheet names. - new - first round google docs interoperability - added filter to strip out control characters from cell data. - added in interop requirements so that charts are properly exported to PDF from Libra Office - - The beginnings of 'The Great Rename' so that all attributes use - snake case, and parse to the proper camel case + - various readability improvements and work standardizing attribute + names to snake_case. Aliases are provided for backward compatiblity - **June.11.12**: 1.1.7 release - fix chart rendering issue when label offset is specified as a percentage in serialization and ensure that formula are not stored diff --git a/examples/example.rb b/examples/example.rb index 464b381d..feec1a08 100755 --- a/examples/example.rb +++ b/examples/example.rb @@ -356,6 +356,70 @@ wb.add_worksheet(:name => 'fixed headers') do |sheet| end end +# conditional formatting +# +percent = wb.styles.add_style(:format_code => "0.00%", :border => Axlsx::STYLE_THIN_BORDER) +money = wb.styles.add_style(:format_code => '0,000', :border => Axlsx::STYLE_THIN_BORDER) + +# define the style for conditional formatting +profitable = wb.styles.add_style( :fg_color=>"FF428751", + :type => :dxf) + +wb.add_worksheet(:name => "Conditional Formatting: Cell Is") do |ws| + + # Generate 20 rows of data + ws.add_row ["Previous Year Quarterly Profits (JPY)"] + ws.add_row ["Quarter", "Profit", "% of Total"] + offset = 3 + rows = 20 + offset.upto(rows + offset) do |i| + ws.add_row ["Q#{i}", 10000*((rows/2-i) * (rows/2-i)), "=100*B#{i}/SUM(B3:B#{rows+offset})"], :style=>[nil, money, percent] + end + +# Apply conditional formatting to range B3:B100 in the worksheet + ws.add_conditional_formatting("B3:B100", { :type => :cellIs, :operator => :greaterThan, :formula => "100000", :dxfId => profitable, :priority => 1 }) +end + +wb.add_worksheet(:name => "Conditional Formatting: Color Scale") do |ws| + ws.add_row ["Previous Year Quarterly Profits (JPY)"] + ws.add_row ["Quarter", "Profit", "% of Total"] + offset = 3 + rows = 20 + offset.upto(rows + offset) do |i| + ws.add_row ["Q#{i}", 10000*((rows/2-i) * (rows/2-i)), "=100*B#{i}/SUM(B3:B#{rows+offset})"], :style=>[nil, money, percent] + end +# Apply conditional formatting to range B3:B100 in the worksheet + color_scale = Axlsx::ColorScale.new + ws.add_conditional_formatting("B3:B100", { :type => :colorScale, :operator => :greaterThan, :formula => "100000", :dxfId => profitable, :priority => 1, :color_scale => color_scale }) +end + + +wb.add_worksheet(:name => "Conditional Formatting: Data Bar") do |ws| + ws.add_row ["Previous Year Quarterly Profits (JPY)"] + ws.add_row ["Quarter", "Profit", "% of Total"] + offset = 3 + rows = 20 + offset.upto(rows + offset) do |i| + ws.add_row ["Q#{i}", 10000*((rows/2-i) * (rows/2-i)), "=100*B#{i}/SUM(B3:B#{rows+offset})"], :style=>[nil, money, percent] + end +# Apply conditional formatting to range B3:B100 in the worksheet + data_bar = Axlsx::DataBar.new + ws.add_conditional_formatting("B3:B100", { :type => :dataBar, :dxfId => profitable, :priority => 1, :data_bar => data_bar }) +end + +wb.add_worksheet(:name => "Conditional Formatting: Icon Set") do |ws| + ws.add_row ["Previous Year Quarterly Profits (JPY)"] + ws.add_row ["Quarter", "Profit", "% of Total"] + offset = 3 + rows = 20 + offset.upto(rows + offset) do |i| + ws.add_row ["Q#{i}", 10000*((rows/2-i) * (rows/2-i)), "=100*B#{i}/SUM(B3:B#{rows+offset})"], :style=>[nil, money, percent] + end +# Apply conditional formatting to range B3:B100 in the worksheet + icon_set = Axlsx::IconSet.new + ws.add_conditional_formatting("B3:B100", { :type => :iconSet, :dxfId => profitable, :priority => 1, :icon_set => icon_set }) +end + ##Validate and Serialize #```ruby diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index d33616ba..57456c4e 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -5,6 +5,6 @@ module Axlsx # When using bunle exec rake and referencing the gem on github or locally # it will use the gemspec, which preloads this constant for the gem's version. # We check to make sure that it has not already been loaded - VERSION="1.1.7" unless defined? Axlsx::VERSION + VERSION="1.1.8" unless defined? Axlsx::VERSION end |
