Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger authored Oct 18, 2023
1 parent b64ac23 commit 56ece6e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SpreadsheetArchitect.to_ods(headers: headers, data: data)
SpreadsheetArchitect.to_csv(headers: headers, data: data)
```

Using this style will allow you to utilize any custom performance optimizations during your data generation process. This will come in handy when the spreadsheets get large and things start to get slow. One of my favourites for Rails is [light_record](https://github.com/Paxa/light_record)
Using this style will allow you to utilize any custom performance optimizations during your data generation process. This will come in handy when the spreadsheets get large and any loss in performance starts to matter.

### Rails Relations or an Array of plain Ruby object instances

Expand Down Expand Up @@ -91,10 +91,10 @@ If you want to use a different method name then `spreadsheet_columns` you can pa
Post.to_xlsx(instances: posts, spreadsheet_columns: :my_special_method)
```

Alternatively, you can pass a Proc to the `spreadsheet_columns` option. For those purists that really dont want to define any extra `spreadsheet_columns` instance method on your model, this option can help you work with that methodology.
Alternatively, you can pass a proc to the `spreadsheet_columns` option. For those purists that really dont want to define any extra `spreadsheet_columns` instance method on your model, this option can help you work with that methodology.

```ruby
Post.to_xlsx(instances: posts, spreadsheet_columns: Proc.new{|instance|
Post.to_xlsx(instances: posts, spreadsheet_columns: ->(instance){
[
['Title', :title],
['Content', instance.content.strip],
Expand Down Expand Up @@ -314,6 +314,10 @@ See `test "kitchen sink"` for [XLSX](./test/unit/xlsx/general_test.rb) and [ODS]

I have compiled a list of all available style options for axlsx here: [docs/axlsx_style_reference.md](./docs/axlsx_style_reference.md)

# Tips for Reducing Memory Usage
- Use the `:data` option instead of active record relations
- Utilize the [`light_record`](https://github.com/Paxa/light_record) gem

# Testing / Validating your Spreadsheets

A wise word of advice, when testing your spreadsheets I recommend to use Excel instead of LibreOffice. This is because I have seen through testing, that where LibreOffice seems to just let most incorrect things just slide on through, Excel will not even open the spreadsheet as apparently it is much more strict about the spreadsheet validations. This will help you better identify any incorrect styling or customization issues.
Expand Down

0 comments on commit 56ece6e

Please sign in to comment.