excel_rails 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +81 -0
- data/VERSION +1 -1
- data/excel_rails.gemspec +3 -3
- metadata +5 -5
- data/README.rdoc +0 -17
data/README
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
excel_rails
|
2
|
+
=================
|
3
|
+
|
4
|
+
A Rails plugin to generate xls documents by using rxls templates.
|
5
|
+
|
6
|
+
Based on Defv's railsxls plugin (http://github.com/DefV/railsxls) without the Java part.
|
7
|
+
|
8
|
+
Also inspired heavily from prawn_rails gem (http://github.com/Volundr/prawn-rails).
|
9
|
+
|
10
|
+
Installation
|
11
|
+
============
|
12
|
+
|
13
|
+
Note that this gem works only with Rails 3
|
14
|
+
|
15
|
+
Put the following line in your Gemfile
|
16
|
+
gem 'excel_rails'
|
17
|
+
|
18
|
+
Run 'bundle install'
|
19
|
+
|
20
|
+
Name your views as action.xls.rxls (See below for usage)
|
21
|
+
|
22
|
+
Make a request to your application with .xls extension to respond to excel.
|
23
|
+
|
24
|
+
Dependencies
|
25
|
+
============
|
26
|
+
|
27
|
+
ruby-ole
|
28
|
+
spreadsheet
|
29
|
+
iconv
|
30
|
+
|
31
|
+
Example
|
32
|
+
=======
|
33
|
+
|
34
|
+
Example spreadsheet usage as found here: http://github.com/jacobat/ruby-spreadsheet
|
35
|
+
|
36
|
+
-- in the view "index.xls.rxls"
|
37
|
+
|
38
|
+
excel_document(:filename => "all_lines.xls") do |workbook|
|
39
|
+
sheet = workbook.create_worksheet
|
40
|
+
sheet.name = "What's in a name"
|
41
|
+
|
42
|
+
sheet.row(0).concat %w{Name Country Acknowlegement}
|
43
|
+
sheet[1,0] = 'Japan'
|
44
|
+
row = sheet.row(1)
|
45
|
+
row.push 'Creator of Ruby'
|
46
|
+
row.unshift 'Yukihiro Matsumoto'
|
47
|
+
sheet.row(2).replace [ 'Daniel J. Berger', 'U.S.A.',
|
48
|
+
'Author of original code for Spreadsheet::Excel' ]
|
49
|
+
sheet.row(3).push 'Charles Lowe', 'Author of the ruby-ole Library'
|
50
|
+
sheet.row(3).insert 1, 'Unknown'
|
51
|
+
sheet.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'
|
52
|
+
|
53
|
+
sheet.row(0).height = 18
|
54
|
+
|
55
|
+
format = Spreadsheet::Format.new :color => :blue,
|
56
|
+
:weight => :bold,
|
57
|
+
:size => 18
|
58
|
+
sheet.row(0).default_format = format
|
59
|
+
|
60
|
+
bold = Spreadsheet::Format.new :weight => :bold
|
61
|
+
4.times do |x| sheet.row(x + 1).set_format(0, bold) end
|
62
|
+
end
|
63
|
+
|
64
|
+
In the above file excel_document yields a new Spreadsheet:Workbook object to the block.
|
65
|
+
If you provide a :filename option to the excel_document method, a filename will be provided to the downloaded file.
|
66
|
+
If your browser supports it you can inline the excel document as well.
|
67
|
+
|
68
|
+
-- in the controller
|
69
|
+
|
70
|
+
def index
|
71
|
+
@lines = Line.find(:all)
|
72
|
+
|
73
|
+
respond_to do |format|
|
74
|
+
format.html # index.html.erb
|
75
|
+
format.xml { render :xml => @lines }
|
76
|
+
format.xls
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
Copyright (c) 2010 Aditya Sanghi, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/excel_rails.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{excel_rails}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aditya Sanghi"]
|
@@ -14,13 +14,13 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{asanghi@me.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README
|
17
|
+
"README"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"LICENSE",
|
23
|
-
"README
|
23
|
+
"README",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"excel_rails.gemspec",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excel_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Sanghi
|
@@ -27,12 +27,12 @@ extensions: []
|
|
27
27
|
|
28
28
|
extra_rdoc_files:
|
29
29
|
- LICENSE
|
30
|
-
- README
|
30
|
+
- README
|
31
31
|
files:
|
32
32
|
- .document
|
33
33
|
- .gitignore
|
34
34
|
- LICENSE
|
35
|
-
- README
|
35
|
+
- README
|
36
36
|
- Rakefile
|
37
37
|
- VERSION
|
38
38
|
- excel_rails.gemspec
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= excel_rails
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Aditya Sanghi. See LICENSE for details.
|