caxlsx_rails 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +122 -138
- data/Gemfile.lock.5.2 +163 -116
- data/Gemfile.lock.6.0 +282 -0
- data/README.md +47 -6
- data/lib/axlsx_rails/version.rb +1 -1
- data/spec/dummy_5.2/db/test.sqlite3 +0 -0
- data/spec/dummy_5.2/log/test.log +744 -3357
- data/spec/{dummy_4 → dummy_6.0}/db/test.sqlite3 +0 -0
- data/spec/dummy_6.0/log/test.log +364 -0
- metadata +301 -309
- data/Gemfile.lock.4.2 +0 -255
- data/Gemfile.lock.5.1 +0 -261
- data/spec/dummy_4/log/test.log +0 -4652
- data/spec/dummy_5/db/test.sqlite3 +0 -0
- data/spec/dummy_5/log/test.log +0 -3645
- data/spec/dummy_5.1/db/test.sqlite3 +0 -0
- data/spec/dummy_5.1/log/test.log +0 -3645
data/README.md
CHANGED
@@ -13,13 +13,22 @@ Status](https://coveralls.io/repos/caxlsx/caxlsx_rails/badge.svg)](https://cover
|
|
13
13
|
|
14
14
|
![Total downloads](http://ruby-gem-downloads-badge.herokuapp.com/caxlsx_rails?type=total)
|
15
15
|
![Total downloads axlsx_rails](http://ruby-gem-downloads-badge.herokuapp.com/axlsx_rails?type=total)
|
16
|
-
![Downloads for 0.6.
|
16
|
+
![Downloads for 0.6.3 (latest)](http://ruby-gem-downloads-badge.herokuapp.com/caxlsx_rails/0.6.3?label=0.6.3)
|
17
|
+
|
18
|
+
## Notice: Community Axlsx Organization
|
19
|
+
|
20
|
+
To better maintain the Axlsx ecosystem, all related gems have been forked or moved to the following community organization:
|
21
|
+
|
22
|
+
http://github.com/caxlsx
|
23
|
+
|
24
|
+
[Join the Caxlsx Slack channel](https://join.slack.com/t/caxlsx/shared_invite/enQtOTI5OTM0MzI1Njk5LTBlMDQzNDk2YzkwODMxMmVkODMyYzJiZGU5NTQ3YTg5NTBlN2IwZTlmNTRjNzhiY2E0MDY2OTEyYmFlODI5NjA)
|
17
25
|
|
18
26
|
## Installation
|
19
27
|
|
20
28
|
In your Gemfile:
|
21
29
|
|
22
30
|
```ruby
|
31
|
+
gem 'caxlsx'
|
23
32
|
gem 'caxlsx_rails'
|
24
33
|
```
|
25
34
|
|
@@ -34,12 +43,12 @@ See [previous installations](#previous-installations) if needed.
|
|
34
43
|
|
35
44
|
## FYI
|
36
45
|
|
37
|
-
* This gem depends on [
|
46
|
+
* This gem depends on [caxlsx](https://github.com/caxlsx/caxlsx). See [the blog](http://axlsx.blog.randym.net/) or the [examples page](https://github.com/caxlsx/caxlsx/tree/master/examples) for usage.
|
38
47
|
* Check out [axlsx_styler](https://github.com/sakovias/axlsx_styler) by [sakovias](https://github.com/sakovias) for easier styles and borders!
|
39
48
|
|
40
49
|
## Usage
|
41
50
|
|
42
|
-
Axlsx-Rails provides a renderer and a template handler. It adds the `:xlsx` format and parses `.xlsx.axlsx` templates. This lets you take all the [
|
51
|
+
Axlsx-Rails provides a renderer and a template handler. It adds the `:xlsx` format and parses `.xlsx.axlsx` templates. This lets you take all the [caxlsx](https://github.com/caxlsx/caxlsx) code out of your controller or model and place it inside the template, where view code belongs! **See [this blog post](http://axlsx.blog.randym.net/2012/08/excel-on-rails-like-pro-with-axlsxrails.html) for a more complete walkthrough.**
|
43
52
|
|
44
53
|
### Controller
|
45
54
|
|
@@ -69,7 +78,7 @@ wb.add_worksheet(name: "Buttons") do |sheet|
|
|
69
78
|
end
|
70
79
|
```
|
71
80
|
|
72
|
-
This is where you place all your [
|
81
|
+
This is where you place all your [caxlsx](https://github.com/caxlsx/caxlsx) specific markup. Add worksheets, fill content, merge cells, add styles. See the [caxlsx examples](https://github.com/caxlsx/caxlsx/tree/master/examples) page to see what you can do.
|
73
82
|
|
74
83
|
Remember, like in `erb` templates, view helpers are available to use the `.xlsx.axlsx` template.
|
75
84
|
|
@@ -325,6 +334,30 @@ end
|
|
325
334
|
* If it says your template is missing, check that its extension is `.xlsx.axlsx`.
|
326
335
|
* If you get the error `uninitialized constant Mime::XSLX` you have used `format.xslx` instead of `format.xlsx`, or something similar.
|
327
336
|
|
337
|
+
### Using axlsx_rails in API mode
|
338
|
+
|
339
|
+
In API mode Rails does not include ActionView, so axlsx_rails will not work. To render axlsx_rails templates you must include ActionView::Rendering in your controller and override render_to_body:
|
340
|
+
|
341
|
+
```ruby
|
342
|
+
class MyController < ActionController::API
|
343
|
+
include ActionView::Rendering
|
344
|
+
|
345
|
+
def show
|
346
|
+
respond_to do |format|
|
347
|
+
format.xlsx
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
private
|
352
|
+
|
353
|
+
def render_to_body(options)
|
354
|
+
_render_to_body_with_renderer(options) || super
|
355
|
+
end
|
356
|
+
end
|
357
|
+
```
|
358
|
+
|
359
|
+
See [issue 107](https://github.com/caxlsx/caxlsx_rails/issues/107)
|
360
|
+
|
328
361
|
### Mailer Attachments: No content, cannot read, Invalid Byte Sequence in UTF-8
|
329
362
|
|
330
363
|
If you are having problems with rendering a template and attaching it to a template, try a few options:
|
@@ -348,6 +381,10 @@ end
|
|
348
381
|
|
349
382
|
If you get these errors, please open an issue and share code so the bug can be isolated. Or comment on issue [#29](https://github.com/caxlsx/caxlsx_rails/issues/29) or [#25](https://github.com/caxlsx/caxlsx_rails/issues/25).
|
350
383
|
|
384
|
+
### The unparsed template is returned, or something similar
|
385
|
+
|
386
|
+
Have you followed other tutorials for serving Excel from Rails? Have you declared the MIME type already? These may be incompatible with caxlsx_rails (which declares the MIME type for you.) Remove any vestiges of other tutorials from your code and try again.
|
387
|
+
|
351
388
|
### Generated Files Can't Be Opened or Invalid Byte Sequence in UTF-8
|
352
389
|
|
353
390
|
Both these errors *appear* to be caused by Rails applying a layout to the template. Passing `layout: false` to `render :xlsx` should fix this issue. Version 0.5.0 attempts to fix this issue.
|
@@ -387,7 +424,7 @@ link_to 'Download spreadsheet', path_to_sheet, data: {turbolinks: false}
|
|
387
424
|
|
388
425
|
### What to do
|
389
426
|
|
390
|
-
If you are having problems, try to isolate the issue. Use the console or a script to make sure your data is good. Then create the spreadsheet line by line without Axlsx-Rails to see if you are having
|
427
|
+
If you are having problems, try to isolate the issue. Use the console or a script to make sure your data is good. Then create the spreadsheet line by line without Axlsx-Rails to see if you are having caxlsx problems. If you can manually create the spreadsheet, create an issue and we will work it out.
|
391
428
|
|
392
429
|
## Previous Installations
|
393
430
|
|
@@ -418,7 +455,7 @@ gem 'axlsx_rails'
|
|
418
455
|
## Dependencies
|
419
456
|
|
420
457
|
- [Rails](https://github.com/rails/rails)
|
421
|
-
- [
|
458
|
+
- [caxlsx](https://github.com/caxlsx/caxlsx)
|
422
459
|
|
423
460
|
## Authors
|
424
461
|
|
@@ -449,6 +486,10 @@ source:
|
|
449
486
|
|
450
487
|
## Change log
|
451
488
|
|
489
|
+
**March 8, 2022**: 0.6.3 release
|
490
|
+
|
491
|
+
- Exclude rspec directory (#149)[https://github.com/caxlsx/caxlsx_rails/pull/149]
|
492
|
+
|
452
493
|
**December 18, 2019**: 0.6.2 release
|
453
494
|
|
454
495
|
- Release under caxlsx_rails
|
data/lib/axlsx_rails/version.rb
CHANGED
Binary file
|