public
Description: A copy of the original railsxls plugin, but suited for Rails Edge
Homepage:
Clone URL: git://github.com/DefV/railsxls.git
railsxls / README
100644 95 lines (66 sloc) 2.541 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Rails Worksheet Pluglin
=======================
 
A Rails plugin that allows xls format worksheet documents.
 
Dependencies
 
JDK 1.4 or greater
YAJB 0.8.1 or greater
Jakarta POI (No need for install. Supplied as part of this package)
 
Install Instructions for YAJB
 
You can download YAJB from
http://www.cmt.phys.kyushu-u.ac.jp/~M.Sakurai/java/ruby/yajb-0.8.1.tar.gz
Extract the tar to a temp directory and run setup.rb to install YAJB.
 
USAGE
=====
 
Exposes Jakarta POI library for XLS manipulation through a built-in object
called workbook in the view template. View names should use a .rxls as the extension
 
# Simple Example
 
# views/controller_name/report.rxls
 
sheet = workbook.createSheet("new sheet")
row = sheet.createRow(0)
row.createCell(0).setCellValue(1)
row.createCell(1).setCellValue(1.2)
row.createCell(2).setCellValue("This is a Testing Row")
row.createCell(3).setCellValue("Guru Krupa")
 
 
# controller returns '110.xls'
def report
@client = Client.find(params[:id]) # Which is 110
render :action => 'report', :layout => false
end
 
# controller returns 'report.xls'
def report
   render :action => "report", :layout => false
end
 
# controller returns 'my-report.xls'
def report
   @worksheet_name = 'my-report.xls'
   render :action => "report", :layout => false
end
 
# For large Worksheet documents
 
# Use CellBatch to batch the cell inserts/updates
# Use RowGroupBatch to batch the row grouping calls
# When only single sheet is present, the cell as well as row group
# changes are applied at once aumatically as a single Batch call using
# a custom java Helper function
# When multiple sheets are present, after doing the sheet specific
# cell as well as group operations call CellBatch.write_to(sheet_object)
# for cell updates.
# Call RowGroupBatch.group_rows to apply rowGroupings.
 
CellBatch.add(5,1,"Row 6 col 1")
CellBatch.add(5,2,"Row 6 col 2")
 
CellBatch.add(7,1,"Row 8 col 1")
CellBatch.add(8,2,"Row 9 col 2")
 
RowGroupBatch.add(7,8)
 
CellBatch.add(9,1,"Two rows above is grouped")
 
ADDITIONAL POI USAGE INFORMATION
================================
 
See Jakarta POI Project Home Page below for a quick guide on POI Usage
 
http://jakarta.apache.org/poi/hssf/index.html
 
Jakarta POI API Doc link is given below:
 
http://jakarta.apache.org/poi/apidocs/index.html?org/apache/poi/hssf/usermodel/package-summary.html
 
BUG REPORTS
===========
 
http://github.com/DefV/railsxls/tree/master
 
CHANGE LOG
==========
 
2006-08-18 - Initial Release of version 0.1
2008-10-01 - Changed the plugin so it works with Rails Edge