axlsx_styler 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -14
- data/axlsx_styler.gemspec +1 -1
- data/lib/axlsx_styler/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e2917f628413da559ab046714cfdd1af2a6460
|
4
|
+
data.tar.gz: 15051010630397515b81fbd084cf449537b3dfa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5941ab8c1a7b83ed6a537dcf553907df587a07e06488f1701a42736a790c5e256e1182dfc51305db3d03e53af7300c3967db3525ad8e0f5ede6d1a1c6e2bdb3
|
7
|
+
data.tar.gz: 5b6b5e6531a9a0298744ae25bde5009167211319ff79762f2df44c7cb4caad9b55960351bb184997f5356554a1bf7a48a768b479d76fe54ad0888ef4c413b36a
|
data/README.md
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# axlsx_styler
|
2
2
|
|
3
|
-
[
|
3
|
+
[axlsx](https://github.com/randym/axlsx) gem is an excellent tool to
|
4
4
|
build Excel spreadsheets. The sheets are
|
5
5
|
created row-by-row and styles are immediately added to each cell when a
|
6
|
-
row is created.
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
row is created.
|
7
|
+
|
8
|
+
`axlsx_styler` allows to separate styles from content: you can fill out
|
9
|
+
a spreadsheet with data and apply styles later. Paired with
|
10
|
+
[axlsx_rails](https://github.com/straydogstudio/axlsx_rails) this gem
|
11
|
+
allows to build clean and maintainable Excel views in a Rails app. It can also
|
12
|
+
be used outside of any specific ruby framework as shown in example below.
|
10
13
|
|
11
14
|
## Usage
|
12
15
|
|
13
|
-
This gem
|
14
|
-
styles to ranges of cells, e.g.
|
16
|
+
This gem provides a DSL that allows you to apply styles to ranges of cells, e.g.
|
15
17
|
|
16
18
|
```ruby
|
17
19
|
sheet.add_style 'A1:D10', b: true
|
@@ -38,13 +40,14 @@ workbook.apply_styles
|
|
38
40
|
```
|
39
41
|
|
40
42
|
Here's an example that compares styling a simple table with and without
|
41
|
-
|
43
|
+
`axlsx_styler`. Suppose we wand to create the following spreadsheet:
|
42
44
|
|
43
45
|
![alt text](./spreadsheet.png "Sample Spreadsheet")
|
44
46
|
|
45
|
-
###
|
47
|
+
### `axlsx` paired with `axlsx_styler`
|
46
48
|
|
47
|
-
|
49
|
+
You can apply styles after all data is entered, similar to how you'd create
|
50
|
+
an Excel document by hand:
|
48
51
|
|
49
52
|
```ruby
|
50
53
|
require 'axlsx_styler'
|
@@ -72,10 +75,10 @@ workbook.apply_styles
|
|
72
75
|
axlsx.serialize 'grocery.xlsx'
|
73
76
|
```
|
74
77
|
|
75
|
-
###
|
78
|
+
### `axlsx` gem without `axlsx_styler`
|
76
79
|
|
77
|
-
|
78
|
-
|
80
|
+
Whith plain `axlsx` you need to know which styles you're going to use beforehand.
|
81
|
+
The code for our example is a bit more envolved:
|
79
82
|
|
80
83
|
```ruby
|
81
84
|
require 'axlsx'
|
data/axlsx_styler.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = '>= 1.9.3'
|
28
28
|
|
29
29
|
spec.add_dependency 'axlsx', '~> 2.0'
|
30
|
-
spec.add_dependency 'activesupport', '
|
30
|
+
spec.add_dependency 'activesupport', '>= 3.1'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
33
33
|
spec.add_development_dependency 'rake', '~> 0.9'
|
data/lib/axlsx_styler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axlsx_styler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sakovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: axlsx
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|