diff options
| author | Randy Morgan <[email protected]> | 2011-12-05 09:42:12 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-12-05 09:42:12 +0900 |
| commit | 34b08ce7a0e781ababdf5fb581965201ba578d38 (patch) | |
| tree | d4ca1c051dcebcc7c2535192e26ee038b4923d28 | |
| parent | 73be92c5cd53ddbaaebf5768b481c3278736698b (diff) | |
| download | caxlsx-34b08ce7a0e781ababdf5fb581965201ba578d38.tar.gz caxlsx-34b08ce7a0e781ababdf5fb581965201ba578d38.zip | |
release prep
| -rw-r--r-- | CHANGELOG.md | 14 | ||||
| -rw-r--r-- | README.md | 147 | ||||
| -rw-r--r-- | Rakefile | 13 | ||||
| -rw-r--r-- | lib/axlsx/version.rb | 2 |
4 files changed, 106 insertions, 70 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 889a7469..5286005f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ CHANGELOG --------- +- **October.30.11**: 1.0.10 release + - Updating gemspec to lower gem version requirements. + - Added row.style assignation for updating the cell style for an entire row + - Added col_style method to worksheet upate a the style for a column of cells + - Added cols for an easy reference to columns in a worksheet. + - prep for pre release of acts_as_xlsx gem + - added in travis.ci configuration and build status + - fixed out of range bug in time calculations for 32bit time. + - added i18n for active support + +- **October.26.11**: 1.0.9 release + - Updated to support ruby 1.9.3 + - Updated to eliminate all warnings originating in this gem + - **October.23.11**: 1.0.8 release - Added support for images (jpg, gif, png) in worksheets. @@ -7,10 +7,10 @@ Axlsx: Office Open XML Spreadsheet Generation **Author**: Randy Morgan **Copyright**: 2011 **License**: MIT License -**Latest Version**: 1.0.10 -**Ruby Version**: 1.8.7, 1.9.3 +**Latest Version**: 1.0.11 +**Ruby Version**: 1.8.7, 1.9.2, 1.9.3 -**Release Date**: November 30th 2011 +**Release Date**: December 5th 2011 Synopsis -------- @@ -39,10 +39,16 @@ Feature List **5. Automatic column widths: Axlsx will automatically determine the appropriate width for your columns based on the content in the worksheet. -**6. Support for both 1904 and 1900 epocs configurable in the workbook. +**6. Support for automatically formatted 1904 and 1900 epocs configurable in the workbook. **7. Add jpg, gif and png images to worksheets +**8. Refernce cells in your worksheet with "A1" and "A1:D4" style references or from the workbook using "Sheett1!A3:B4" style references + +**9. Cell level style overrides for default and customized style object + +**10. Support for formulas + Installing ---------- @@ -58,12 +64,25 @@ Usage require 'rubygems' require 'axlsx' + +Validation + + p = Axlsx::Package.new + p.workbook.add_worksheet do |sheet| + sheet.add_row ["First", "Second", "Third"] + sheet.add_row [1, 2, 3] + end + + p.validate.each do |error| + puts error.inspect + end + A Simple Workbook p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| sheet.add_row ["First", "Second", "Third"] - sheet.add_row [1, 2, 3] + sheet.add_row [1, 2, Time.now] end p.serialize("example1.xlsx") @@ -71,10 +90,11 @@ Generating A Bar Chart p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| + sheet.add_row ["A Simple Bar Chart"] sheet.add_row ["First", "Second", "Third"] sheet.add_row [1, 2, 3] - sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart| - chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells + sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A4", :end_at => "F17", :title=>sheet["A1"]) do |chart| + chart.add_series :data => sheet["A3:C3"], :labels => sheet["A2:C2"] end end p.serialize("example2.xlsx") @@ -83,25 +103,41 @@ Generating A Pie Chart p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| - sheet.add_row ["First", "Second", "Third"] - sheet.add_row [1, 2, 3] - sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart| - chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells + sheet.add_row ["First", "Second", "Third", "Fourth"] + sheet.add_row [1, 2, 3, "=PRODUCT(A2:C2)"] + sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0, 2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart| + chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"] end end p.serialize("example3.xlsx") +Generating A Line Chart + + p = Axlsx::Package.new + p.workbook.add_worksheet do |sheet| + sheet.add_row ["First", 1, 5, 7, 9] + sheet.add_row ["Second", 5, 2, 14, 9] + sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart| + chart.start_at 0, 2 + chart.end_at 10, 15 + chart.add_series :data=>sheet["B1:E1"], :title=> sheet["A1"] + chart.add_series :data=>sheet["B2:E2"], :title=> sheet["A2"] + end + + end + p.serialize("example4.xlsx") + Using Custom Styles p = Axlsx::Package.new wb = p.workbook - black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center } - blue_cell = wb.styles.add_style :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center } + black_cell = wb.styles.add_style :bg_color => "00", :fg_color => "FF", :sz=>14, :alignment => { :horizontal=> :center } + blue_cell = wb.styles.add_style :bg_color => "0000FF", :fg_color => "FF", :sz=>14, :alignment => { :horizontal=> :center } wb.add_worksheet do |sheet| sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell] sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER end - p.serialize("example4.xlsx") + p.serialize("example5.xlsx") Using Custom Formatting and date1904 @@ -115,47 +151,22 @@ Using Custom Formatting and date1904 sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded] end - p.serialize("example5.xlsx") - -Validation - - p = Axlsx::Package.new - p.workbook.add_worksheet do |sheet| - sheet.add_row ["First", "Second", "Third"] - sheet.add_row [1, 2, 3] - end - - p.validate.each do |error| - puts error.inspect - end + p.serialize("example6.xlsx") -Generating A Line Chart - p = Axlsx::Package.new - p.workbook.add_worksheet do |sheet| - sheet.add_row ["First", 1, 5, 7, 9] - sheet.add_row ["Second", 5, 2, 14, 9] - sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart| - chart.start_at 0, 2 - chart.end_at 10, 15 - chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first - chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first - end - - end - p.serialize("example6.xlsx") -Adding an Image +Add an Image p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| - sheet.add_image(:image_src => (File.dirname(__FILE__) + "/image1.png")) do |image| + img = File.expand_path('examples/image1.jpeg') + sheet.add_image(:image_src => img, :noSelect=>true, :noMove=>true) do |image| image.width=720 image.height=666 image.start_at 2, 2 end end - p.serialize("example7.xlsx") + p.serialize("example8.xlsx") Asian Language Support @@ -165,7 +176,7 @@ Asian Language Support sheet.add_row ["华语/華語"] sheet.add_row ["한국어/조선말"] end - p.serialize("example8.xlsx") + p.serialize("example9.xlsx") Styling Columns @@ -189,12 +200,36 @@ Styling Rows sheet.add_row [1, 2, 0.2, 4] sheet.add_row [1, 2, 0.1, 4] end - head = p.workbook.styles.add_style :bg_color => "FF000000", :fg_color=>"FFFFFFFF" + head = p.workbook.styles.add_style :bg_color => "00", :fg_color=>"FF" percent = p.workbook.styles.add_style :num_fmt => 9 p.workbook.worksheets.first.col_style 2, percent, :row_offset=>1 p.workbook.worksheets.first.row_style 0, head p.serialize("example11.xlsx") +Using formula + + p = Axlsx::Package.new + p.workbook.add_worksheet do |sheet| + sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4'] + sheet.add_row [1, 2, 3, "=SUM(A2:C2)"] + end + p.serialize("example12.xlsx") + +Using cell specific styling and range / name based access + + p = Axlsx::Package.new + p.workbook.add_worksheet(:name=>'My Worksheet') do |sheet| + # cell level style overides when adding cells + sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4'], :sz => 16 + sheet.add_row [1, 2, 3, "=SUM(A2:C2)"] + # cell level style overrides via sheet range + sheet["A1:D1"].each { |c| c.color = "FF0000"} + end + p.workbook['My Worksheet!A1:D2'].each { |c| c.style = Axlsx::STYLE_THIN_BORDER } + p.serialize("example13.xlsx") + + + ###Documentation This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use: @@ -209,19 +244,13 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem, Changelog --------- -- **October.30.11**: 1.0.10 release - - Updating gemspec to lower gem version requirements. - - Added row.style assignation for updating the cell style for an entire row - - Added col_style method to worksheet upate a the style for a column of cells - - Added cols for an easy reference to columns in a worksheet. - - prep for pre release of acts_as_xlsx gem - - added in travis.ci configuration and build status - - fixed out of range bug in time calculations for 32bit time. - - added i18n for active support - -- **October.26.11**: 1.0.9 release - - Updated to support ruby 1.9.3 - - Updated to eliminate all warnings originating in this gem +- **December.5.11**: 1.0.11 release + - Added [] methods to worksheet and workbook to provide name based access to cells. + - Added support for functions as cell values + - Updated color creation so that two character shorthand values can be used like 'FF' for 'FFFFFFFF' or 'D8' for 'FFD8D8D8' + - Examples for all this fun stuff added to the readme + - Clean up and support for 1.9.2 and travis integration + - Added support for string based cell referencing to chart start_at and end_at. That means you can now use :start_at=>"A1" when using worksheet.add_chart, or chart.start_at ="A1" in addition to passing a cell or the x, y coordinates. Please see the {file:CHANGELOG.md} document for past release information. @@ -1,12 +1,5 @@ require File.expand_path(File.dirname(__FILE__) + '/lib/axlsx/version.rb') -begin - require 'bundler' - Bundler::GemHelper.install_tasks -rescue LoadError - $stderr.puts "You should install Bundler with: gem install bundler" -end - task :build => :gendoc do system "gem build axlsx.gemspec" end @@ -24,8 +17,8 @@ task :test do end end -#task :release => :build do -# system "gem push axlsx-#{Axlsx::VERSION}.gem" -#end +task :release => :build do + system "gem push axlsx-#{Axlsx::VERSION}.gem" +end task :default => :test
\ No newline at end of file diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index 92993f79..f6a14039 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -1,4 +1,4 @@ module Axlsx # version - VERSION="1.0.10" + VERSION="1.0.11" end |
