From cb9edc7bf2de8ffa7baf6f6e3208773c67b977b5 Mon Sep 17 00:00:00 2001 From: Weston Ganger Date: Tue, 12 Feb 2019 14:11:31 -0800 Subject: [PATCH] Documentation Fixes --- CHANGELOG.md | 1 + README.md | 84 +++++++++++++++++++++++++++------------------------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d607c..5be640e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ## v1.0.1 - UNRELEASED + * [#34](https://github.com/westonganger/rodf/pull/34) - Add ability to add many rows or cells at once * [#29](https://github.com/westonganger/rodf/pull/29) - Remove ActiveSupport dependency in favor of `dry-inflector` * [#21](https://github.com/thiagoarrais/rodf/pull/21) - Allow more attributes for the `data_style` method * [#19](https://github.com/westonganger/rodf/issues/19) - Changes to Date/Time handling diff --git a/README.md b/README.md index 427a6a1..c241e72 100644 --- a/README.md +++ b/README.md @@ -48,26 +48,61 @@ RODF::Spreadsheet.file("my-spreadsheet.ods") do |spreadsheet| end ``` -Bunches are also possible: +Adding many rows or cells at once is supported as well: ```ruby require 'rodf' RODF::Spreadsheet.file("my-spreadsheet.ods") do table 'My first table from Ruby' do - row do - add_cells ['ID', 'Name'] - end - add_rows([ [1, 'Alice'], [2, { value: 'Bob', color: '#ff0000'}], [3, 'Carol'] ]) + + row do + add_cells ['ID', 'Name'] + end end end ``` +## Procedural style + +The declarative style shown above is just syntatic sugar. A more procedural +style can also be used. Like so: + +```ruby +require 'rodf' + +ss = RODF::Spreadsheet.new +t = ss.table 'My first table from Ruby' +r = t.row +c = r.cell 'Hello, rODF world!' + +# two methods to write to file +ss.write_to 'my-spreadsheet.ods' +# or +File.write('my-spreadsheet.ods', ss.bytes) # you can send your data in Rails over HTTP using the bytes method +end +``` + +Both styles can be mixed and matched at will: + +```ruby +require 'rodf' + +ss = RODF::Spreadsheet.new +ss.table 'My first table from Ruby' do + row do + cell 'Hello, rODF world!' + end +end + +ss.write_to 'my-spreadsheet.ods' +``` + Styling and formatting is also possible: ```ruby @@ -126,41 +161,6 @@ RODF::Spreadsheet.file("my-spreadsheet.ods") do end ``` -## Procedural style - -The declarative style shown above is just syntatic sugar. A more procedural -style can also be used. Like so: - -```ruby -require 'rodf' - -ss = RODF::Spreadsheet.new -t = ss.table 'My first table from Ruby' -r = t.row -c = r.cell 'Hello, rODF world!' - -# two methods to write to file -ss.write_to 'my-spreadsheet.ods' -# or -File.write('my-spreadsheet.ods', ss.bytes) # you can send your data in Rails over HTTP using the bytes method -end -``` - -Both styles can be mixed and matched at will: - -```ruby -require 'rodf' - -ss = RODF::Spreadsheet.new -ss.table 'My first table from Ruby' do - row do - cell 'Hello, rODF world!' - end -end - -ss.write_to 'my-spreadsheet.ods' -``` - ## Columns Types Available columns types are: @@ -207,6 +207,8 @@ property :table, ## Credits -Created by Thiago Arrais [(@thiagoarrais)](https://github.com/thiagoarrais) +Currently Maintained by [@westonganger](https://github.com/westonganger) for simplified ODS spreadsheet creation in the [spreadsheet_architect](https://github.com/westonganger/spreadsheet_architect) gem + +Originally Created by [@thiagoarrais](https://github.com/thiagoarrais) Created & Maintained by [Weston Ganger](https://westonganger.com) [(@westonganger)](https://github.com/westonganger) to support simplified ODS spreadsheet making in the [spreadsheet_architect](https://github.com/westonganger/spreadsheet_architect) gem