README.md in spreadsheet_architect-2.0.2 vs README.md in spreadsheet_architect-2.1.0

- old
+ new

@@ -90,22 +90,22 @@ @posts = Post.order(published_at: :asc) respond_with @posts end - # Using respond_with with custom options + # OR Using respond_with with custom options def index @posts = Post.order(published_at: :asc) if ['xlsx','ods','csv'].include?(request.format) respond_with @posts.to_xlsx(row_style: {bold: true}), filename: 'Posts' else respond_with @posts end end - # Using responders + # OR Using responders def index @posts = Post.order(published_at: :asc) respond_to do |format| format.html @@ -113,11 +113,11 @@ format.ods { render ods: @posts } format.csv{ render csv: @posts } end end - # Using responders with custom options + # OR Using responders with custom options def index @posts = Post.order(published_at: :asc) respond_to do |format| format.html @@ -131,29 +131,29 @@ ### Method 2: Save to a file manually ```ruby # Ex. with ActiveRecord relation File.open('path/to/file.xlsx', 'w+b') do |f| - f.write{ Post.order(published_at: :asc).to_xlsx } + f.write Post.order(published_at: :asc).to_xlsx end File.open('path/to/file.ods', 'w+b') do |f| - f.write{ Post.order(published_at: :asc).to_ods } + f.write Post.order(published_at: :asc).to_ods end File.open('path/to/file.csv', 'w+b') do |f| - f.write{ Post.order(published_at: :asc).to_csv } + f.write Post.order(published_at: :asc).to_csv end # Ex. with plain ruby class File.open('path/to/file.xlsx', 'w+b') do |f| - f.write{ Post.to_xlsx(instances: posts_array) } + f.write Post.to_xlsx(instances: posts_array) end # Ex. One time Usage File.open('path/to/file.xlsx', 'w+b') do |f| headers = ['Col 1','Col 2','Col 3'] data = [[1,2,3], [4,5,6], [7,8,9]] - f.write{ SpreadsheetArchitect::to_xlsx(data: data, headers: headers) } + f.write SpreadsheetArchitect::to_xlsx(data: data, headers: headers) end ``` <br> # Methods & Options @@ -211,11 +211,11 @@ |**row_style**<br>*Hash*|`{background_color: nil, color: "000000", align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false, format_code: nil}`|Styles for non-header rows. See all available style options [here](https://github.com/westonganger/spreadsheet_architect/blob/master/docs/axlsx_styles_reference.md)| |**column_styles**<br>*Array*||[See this example for usage](https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb)| |**range_styles**<br>*Array*||[See this example for usage](https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb)| |**merges**<br>*Array*||Merge cells. [See this example for usage](https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb)| |**borders**<br>*Array*||[See this example for usage](https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb)| -|**column_types**<br>*Array*||Valid types for XLSX are :string, :integer, :float, :date, :time, :boolean, nil = auto determine| +|**column_types**<br>*Array*||Valid types for XLSX are :string, :integer, :float, :boolean, nil = auto determine.| |**column_widths**<br>*Array*||Sometimes you may want explicit column widths. Use nil if you want a column to autofit again.| <br> ## SpreadsheetArchitect.to_ods @@ -225,11 +225,11 @@ |**data**<br>*2D Array*| |Data for the non-header row cells.| |**headers**<br>*2D Array*|`false`|Data for the header rows cells. Pass `false` to skip the header row.| |**sheet_name**<br>*String*|`Sheet1`|| |**header_style**<br>*Hash*|`{background_color: "AAAAAA", color: "FFFFFF", align: :center, font_size: 10, bold: true}`|Note: Currently ODS only supports these options| |**row_style**<br>*Hash*|`{background_color: nil, color: "000000", align: :left, font_size: 10, bold: false}`|Styles for non-header rows. Currently ODS only supports these options| -|**column_types**<br>*Array*||Valid types for ODS are :string, :float, :date, :percent, :currency, nil = auto determine| +|**column_types**<br>*Array*||Valid types for ODS are :string, :float, :date, :time, :percent, :currency, nil = auto determine. Due to [RODF issue #19](https://github.com/thiagoarrais/rodf/issues/19), :date/:time will be converted to :string | <br> ## SpreadsheetArchitect.to_csv @@ -270,22 +270,22 @@ # config/initializers/spreadsheet_architect.rb SpreadsheetArchitect.default_options = { headers: true, header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false}, - row_style: {background_color: nil, color: 'FFFFFF', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false}, + row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false}, sheet_name: 'My Project Export', column_styles: [], range_styles: [], merges: [], borders: [], column_types: [] } ``` # Complex XLSX Example with Styling -See this example: (https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb) +See this example: https://github.com/westonganger/spreadsheet_architect/blob/master/examples/complex_xlsx_styling.rb # Multi Sheet XLSX or ODS spreadsheets ```ruby # Returns corresponding spreadsheet libraries object @@ -294,18 +294,18 @@ spreadsheet = SpreadsheetArchitect.to_rodf_spreadsheet({data: data, headers: headers}) SpreadsheetArchitect.to_rodf_spreadsheet({data: data, headers: headers}, spreadsheet) # to combine two sheets to one file ``` -See this example: (https://github.com/westonganger/spreadsheet_architect/blob/master/examples/multi_sheet_spreadsheets.rb) +See this example: https://github.com/westonganger/spreadsheet_architect/blob/master/examples/multi_sheet_spreadsheets.rb # Axlsx Style Reference -I have compiled a list of all available style options for `axlsx` here: (https://github.com/westonganger/spreadsheet_architect/blob/master/docs/axlsx_style_reference.md) +I have compiled a list of all available style options for axlsx here: https://github.com/westonganger/spreadsheet_architect/blob/master/docs/axlsx_style_reference.md # Credits Created by [@westonganger](https://github.com/westonganger) For any consulting or contract work please contact me via my company website: [Solid Foundation Web Development](https://solidfoundationwebdev.com) -[![Solid Foundation Web Development Logo](https://solidfoundationwebdev.com/logo.png)](https://solidfoundationwebdev.com) +[![Solid Foundation Web Development Logo](https://solidfoundationwebdev.com/logo-sm.png)](https://solidfoundationwebdev.com)