osheet-xmlss 1.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +9 -0
- data/LICENSE +22 -0
- data/README.md +131 -0
- data/Rakefile +49 -0
- data/bench/bench_runner.rb +91 -0
- data/bench/profiler.rb +6 -0
- data/bench/profiler_1000.xls +17015 -0
- data/bench/profiler_runner.rb +40 -0
- data/examples/basic.rb +77 -0
- data/examples/basic.xls +2 -0
- data/examples/basic_with_templates.rb +87 -0
- data/examples/basic_with_templates.xls +93 -0
- data/examples/formats.rb +370 -0
- data/examples/formats.xls +768 -0
- data/examples/formula.rb +42 -0
- data/examples/formula.xls +36 -0
- data/examples/styles.rb +255 -0
- data/examples/styles.xls +343 -0
- data/examples/trivial.rb +25 -0
- data/examples/trivial.xls +18 -0
- data/lib/osheet/xmlss/style_cache.rb +63 -0
- data/lib/osheet/xmlss/style_settings.rb +148 -0
- data/lib/osheet/xmlss/version.rb +4 -0
- data/lib/osheet/xmlss.rb +7 -0
- data/lib/osheet/xmlss_writer.rb +143 -0
- data/osheet-xmlss.gemspec +24 -0
- data/test/helper.rb +17 -0
- data/test/irb.rb +9 -0
- data/test/xmlss/api_test.rb +139 -0
- data/test/xmlss/style_cache_test.rb +65 -0
- data/test/xmlss/style_settings_test.rb +263 -0
- data/test/xmlss/styles_test.rb +340 -0
- data/test/xmlss_writer_test.rb +92 -0
- metadata +157 -0
data/examples/formula.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# To run:
|
2
|
+
# $ bundle install
|
3
|
+
# $ bundle exec ruby examples/formula.rb
|
4
|
+
# $ open examples/formula.xls
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'osheet/xmlss'
|
8
|
+
|
9
|
+
# this will dump the above data to a single-sheet workbook w/ no styles
|
10
|
+
|
11
|
+
puts "building examples/formula.rb ..."
|
12
|
+
|
13
|
+
Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2)) {
|
14
|
+
title "formula example"
|
15
|
+
worksheet {
|
16
|
+
name "Formula"
|
17
|
+
row {
|
18
|
+
cell { data 1 }
|
19
|
+
cell { data 2 }
|
20
|
+
# please note formulas use R1C1 notation
|
21
|
+
# check out for example http://www.bettersolutions.com/excel/EED883/YI416010881.htm
|
22
|
+
# this is absolute reference, ie. =$A$1+$B$1
|
23
|
+
cell { formula "=R1C1+R1C2" }
|
24
|
+
}
|
25
|
+
}
|
26
|
+
worksheet {
|
27
|
+
name "Refers to previous sheet"
|
28
|
+
row {
|
29
|
+
cell { data 3 }
|
30
|
+
cell { data 4 }
|
31
|
+
cell {
|
32
|
+
# you can still refer to cells in other sheets through the name of the sheet and !
|
33
|
+
# this is also a relative reference, ie. =Formula!A1+B2
|
34
|
+
formula "=Formula!RC[-2]+RC[-1]"
|
35
|
+
# 6 will change into 5 when formula gets recalculated
|
36
|
+
data 6
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}.to_file('examples/formula.xls')
|
41
|
+
|
42
|
+
puts "open examples/formula.xls"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
|
3
|
+
<Styles>
|
4
|
+
|
5
|
+
</Styles>
|
6
|
+
<Worksheet ss:Name="Formula">
|
7
|
+
<Table>
|
8
|
+
<Row>
|
9
|
+
<Cell>
|
10
|
+
<Data ss:Type="Number">1</Data>
|
11
|
+
</Cell>
|
12
|
+
<Cell>
|
13
|
+
<Data ss:Type="Number">2</Data>
|
14
|
+
</Cell>
|
15
|
+
<Cell ss:Formula="=R1C1+R1C2">
|
16
|
+
<Data ss:Type="String"></Data>
|
17
|
+
</Cell>
|
18
|
+
</Row>
|
19
|
+
</Table>
|
20
|
+
</Worksheet>
|
21
|
+
<Worksheet ss:Name="Refers to previous sheet">
|
22
|
+
<Table>
|
23
|
+
<Row>
|
24
|
+
<Cell>
|
25
|
+
<Data ss:Type="Number">3</Data>
|
26
|
+
</Cell>
|
27
|
+
<Cell>
|
28
|
+
<Data ss:Type="Number">4</Data>
|
29
|
+
</Cell>
|
30
|
+
<Cell ss:Formula="=Formula!RC[-2]+RC[-1]">
|
31
|
+
<Data ss:Type="Number">6</Data>
|
32
|
+
</Cell>
|
33
|
+
</Row>
|
34
|
+
</Table>
|
35
|
+
</Worksheet>
|
36
|
+
</Workbook>
|
data/examples/styles.rb
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
# To run:
|
2
|
+
# $ bundle install
|
3
|
+
# $ bundle exec ruby examples/styles.rb
|
4
|
+
# $ open examples/styles.xls
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'osheet/xmlss'
|
8
|
+
|
9
|
+
puts "building examples/styles.rb ..."
|
10
|
+
|
11
|
+
Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2)) {
|
12
|
+
title "styles"
|
13
|
+
template(:cell, :styled) { |style, attribute|
|
14
|
+
data attribute == :wrap ? (attribute.to_s+' ')*20 : attribute.to_s
|
15
|
+
style_class "#{style} #{attribute}"
|
16
|
+
}
|
17
|
+
|
18
|
+
# align styles
|
19
|
+
style('.align.left') { align :left }
|
20
|
+
style('.align.center') { align :center }
|
21
|
+
style('.align.right') { align :right }
|
22
|
+
style('.align.top') { align :top }
|
23
|
+
style('.align.middle') { align :middle }
|
24
|
+
style('.align.bottom') { align :bottom }
|
25
|
+
style('.align.wrap') { align :wrap }
|
26
|
+
style('.align.rotA') { align 90 }
|
27
|
+
style('.align.rotB') { align -90 }
|
28
|
+
style('.align.rotC') { align 45 }
|
29
|
+
|
30
|
+
worksheet {
|
31
|
+
name "align"
|
32
|
+
|
33
|
+
(0..3).each do
|
34
|
+
column {
|
35
|
+
width 100
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
{ 'Horizontal alignment' => [:left, :center, :right],
|
40
|
+
'Vertical alignment' => [:top, :middle, :bottom],
|
41
|
+
'Wrap text' => [:wrap],
|
42
|
+
'Rotate text' => [:rotA, :rotB, :rotC]
|
43
|
+
}.each do |k,v|
|
44
|
+
row {
|
45
|
+
height 50
|
46
|
+
v.each {|a| cell(:styled, 'align', a) }
|
47
|
+
}
|
48
|
+
end
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
# font styles
|
54
|
+
style('.font.underline') { font :underline }
|
55
|
+
style('.font.double_underline') { font :double_underline }
|
56
|
+
style('.font.accounting_underline') { font :accounting_underline }
|
57
|
+
style('.font.double_accounting_underline') { font :double_accounting_underline }
|
58
|
+
style('.font.subscript') { font :subscript }
|
59
|
+
style('.font.superscript') { font :superscript }
|
60
|
+
style('.font.strikethrough') { font :strikethrough }
|
61
|
+
style('.font.shadow') { font :shadow }
|
62
|
+
style('.font.bold') { font :bold }
|
63
|
+
style('.font.italic') { font :italic }
|
64
|
+
style('.font.sizeA') { font 6 }
|
65
|
+
style('.font.sizeB') { font 14 }
|
66
|
+
style('.font.colorA') { font '#FF0000' }
|
67
|
+
style('.font.colorB') { font '#00FF00' }
|
68
|
+
style('.font.nameA') { font 'Courier' }
|
69
|
+
style('.font.nameB') { font 'Times New Roman' }
|
70
|
+
|
71
|
+
worksheet {
|
72
|
+
name "font"
|
73
|
+
|
74
|
+
(0..5).each do
|
75
|
+
column {
|
76
|
+
width 100
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
row {
|
81
|
+
[:underline, :double_underline, :accounting_underline, :double_accounting_underline].each do |a|
|
82
|
+
cell {
|
83
|
+
data a.to_s
|
84
|
+
style_class "font #{a}"
|
85
|
+
}
|
86
|
+
end
|
87
|
+
}
|
88
|
+
row {
|
89
|
+
[:subscript, :superscript, :strikethrough, :shadow].each do |a|
|
90
|
+
cell {
|
91
|
+
data a.to_s
|
92
|
+
style_class "font #{a}"
|
93
|
+
}
|
94
|
+
end
|
95
|
+
}
|
96
|
+
row {
|
97
|
+
[:bold, :italic].each do |a|
|
98
|
+
cell {
|
99
|
+
data a.to_s
|
100
|
+
style_class "font #{a}"
|
101
|
+
}
|
102
|
+
end
|
103
|
+
}
|
104
|
+
row {
|
105
|
+
[:sizeA, :sizeB].each do |a|
|
106
|
+
cell {
|
107
|
+
data a.to_s
|
108
|
+
style_class "font #{a}"
|
109
|
+
}
|
110
|
+
end
|
111
|
+
}
|
112
|
+
row {
|
113
|
+
[:colorA, :colorB].each do |a|
|
114
|
+
cell {
|
115
|
+
data a.to_s
|
116
|
+
style_class "font #{a}"
|
117
|
+
}
|
118
|
+
end
|
119
|
+
}
|
120
|
+
row {
|
121
|
+
[:nameA, :nameB].each do |a|
|
122
|
+
cell {
|
123
|
+
data a.to_s
|
124
|
+
style_class "font #{a}"
|
125
|
+
}
|
126
|
+
end
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
# bg styles
|
133
|
+
style('.bg.color') {
|
134
|
+
bg '#FF0000'
|
135
|
+
font '#FFFFFF'
|
136
|
+
}
|
137
|
+
style('.bg.pattern') {
|
138
|
+
bg :horz_stripe
|
139
|
+
}
|
140
|
+
style('.bg.pattern.color') {
|
141
|
+
bg '#FF0000', :horz_stripe => '#000000'
|
142
|
+
font '#FFFFFF'
|
143
|
+
}
|
144
|
+
|
145
|
+
worksheet {
|
146
|
+
name "bg"
|
147
|
+
|
148
|
+
column {
|
149
|
+
width 100
|
150
|
+
}
|
151
|
+
|
152
|
+
row {
|
153
|
+
height 50
|
154
|
+
cell {
|
155
|
+
style_class "bg color"
|
156
|
+
data 'COLOR'
|
157
|
+
}
|
158
|
+
}
|
159
|
+
row {
|
160
|
+
height 50
|
161
|
+
cell {
|
162
|
+
style_class "bg pattern"
|
163
|
+
data 'PATTERN'
|
164
|
+
}
|
165
|
+
}
|
166
|
+
row {
|
167
|
+
height 50
|
168
|
+
cell {
|
169
|
+
style_class "bg pattern color"
|
170
|
+
data 'PATTERN COLOR'
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# border styles
|
178
|
+
style('.border.top.color') { border_top '#FF0000' }
|
179
|
+
style('.border.right.color') { border_right '#00FF00' }
|
180
|
+
style('.border.bottom.color') { border_bottom '#0000FF' }
|
181
|
+
style('.border.left.color') { border_left '#FFFF00' }
|
182
|
+
style('.border.top.weight') { border_top :hairline }
|
183
|
+
style('.border.right.weight') { border_right :thin }
|
184
|
+
style('.border.bottom.weight') { border_bottom :medium }
|
185
|
+
style('.border.left.weight') { border_left :thick }
|
186
|
+
style('.border.top.style') { border_top :continuous }
|
187
|
+
style('.border.right.style') { border_right :dash }
|
188
|
+
style('.border.bottom.style') { border_bottom :dot }
|
189
|
+
style('.border.left.style') { border_left :dash_dot }
|
190
|
+
style('.border.all') {
|
191
|
+
border :continuous, :thick, '#00FFFF'
|
192
|
+
}
|
193
|
+
|
194
|
+
worksheet {
|
195
|
+
name "border"
|
196
|
+
|
197
|
+
column {
|
198
|
+
width 20
|
199
|
+
}
|
200
|
+
column {
|
201
|
+
width 200
|
202
|
+
}
|
203
|
+
|
204
|
+
row {}
|
205
|
+
row {
|
206
|
+
height 50
|
207
|
+
cell {}
|
208
|
+
cell {
|
209
|
+
style_class "border top color weight style"
|
210
|
+
data 'top red hairline continuous'
|
211
|
+
}
|
212
|
+
}
|
213
|
+
row {}
|
214
|
+
row {
|
215
|
+
height 50
|
216
|
+
cell {}
|
217
|
+
cell {
|
218
|
+
style_class "border right color weight style"
|
219
|
+
data 'right green thin dash'
|
220
|
+
}
|
221
|
+
}
|
222
|
+
row {}
|
223
|
+
row {
|
224
|
+
height 50
|
225
|
+
cell {}
|
226
|
+
cell {
|
227
|
+
style_class "border bottom color weight style"
|
228
|
+
data 'bottom blue medium dat'
|
229
|
+
}
|
230
|
+
}
|
231
|
+
row {}
|
232
|
+
row {
|
233
|
+
height 50
|
234
|
+
cell {}
|
235
|
+
cell {
|
236
|
+
style_class "border left color weight style"
|
237
|
+
data 'left yellow thick dast_dot'
|
238
|
+
}
|
239
|
+
}
|
240
|
+
row {}
|
241
|
+
row {
|
242
|
+
height 50
|
243
|
+
cell {}
|
244
|
+
cell {
|
245
|
+
style_class "border all"
|
246
|
+
data 'all aqua'
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
}.to_file('examples/styles.xls')
|
254
|
+
|
255
|
+
puts "open examples/styles.xls"
|
data/examples/styles.xls
ADDED
@@ -0,0 +1,343 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
|
3
|
+
<Styles>
|
4
|
+
<Style ss:ID=".align.rotA">
|
5
|
+
<Alignment ss:Rotate="90" />
|
6
|
+
<NumberFormat />
|
7
|
+
</Style>
|
8
|
+
<Style ss:ID=".align.rotB">
|
9
|
+
<Alignment ss:Rotate="-90" />
|
10
|
+
<NumberFormat />
|
11
|
+
</Style>
|
12
|
+
<Style ss:ID=".align.rotC">
|
13
|
+
<Alignment ss:Rotate="45" />
|
14
|
+
<NumberFormat />
|
15
|
+
</Style>
|
16
|
+
<Style ss:ID=".align.top">
|
17
|
+
<Alignment ss:Vertical="Top" />
|
18
|
+
<NumberFormat />
|
19
|
+
</Style>
|
20
|
+
<Style ss:ID=".align.middle">
|
21
|
+
<Alignment ss:Vertical="Center" />
|
22
|
+
<NumberFormat />
|
23
|
+
</Style>
|
24
|
+
<Style ss:ID=".align.bottom">
|
25
|
+
<Alignment ss:Vertical="Bottom" />
|
26
|
+
<NumberFormat />
|
27
|
+
</Style>
|
28
|
+
<Style ss:ID=".align.wrap">
|
29
|
+
<Alignment ss:WrapText="1" />
|
30
|
+
<NumberFormat />
|
31
|
+
</Style>
|
32
|
+
<Style ss:ID=".align.left">
|
33
|
+
<Alignment ss:Horizontal="Left" />
|
34
|
+
<NumberFormat />
|
35
|
+
</Style>
|
36
|
+
<Style ss:ID=".align.center">
|
37
|
+
<Alignment ss:Horizontal="Center" />
|
38
|
+
<NumberFormat />
|
39
|
+
</Style>
|
40
|
+
<Style ss:ID=".align.right">
|
41
|
+
<Alignment ss:Horizontal="Right" />
|
42
|
+
<NumberFormat />
|
43
|
+
</Style>
|
44
|
+
<Style ss:ID=".font.underline">
|
45
|
+
<Font ss:Underline="Single" />
|
46
|
+
<NumberFormat />
|
47
|
+
</Style>
|
48
|
+
<Style ss:ID=".font.double_underline">
|
49
|
+
<Font ss:Underline="Double" />
|
50
|
+
<NumberFormat />
|
51
|
+
</Style>
|
52
|
+
<Style ss:ID=".font.accounting_underline">
|
53
|
+
<Font ss:Underline="SingleAccounting" />
|
54
|
+
<NumberFormat />
|
55
|
+
</Style>
|
56
|
+
<Style ss:ID=".font.double_accounting_underline">
|
57
|
+
<Font ss:Underline="DoubleAccounting" />
|
58
|
+
<NumberFormat />
|
59
|
+
</Style>
|
60
|
+
<Style ss:ID=".font.subscript">
|
61
|
+
<Font ss:VerticalAlign="Subscript" />
|
62
|
+
<NumberFormat />
|
63
|
+
</Style>
|
64
|
+
<Style ss:ID=".font.superscript">
|
65
|
+
<Font ss:VerticalAlign="Superscript" />
|
66
|
+
<NumberFormat />
|
67
|
+
</Style>
|
68
|
+
<Style ss:ID=".font.strikethrough">
|
69
|
+
<Font ss:StrikeThrough="1" />
|
70
|
+
<NumberFormat />
|
71
|
+
</Style>
|
72
|
+
<Style ss:ID=".font.shadow">
|
73
|
+
<Font ss:Shadow="1" />
|
74
|
+
<NumberFormat />
|
75
|
+
</Style>
|
76
|
+
<Style ss:ID=".font.bold">
|
77
|
+
<Font ss:Bold="1" />
|
78
|
+
<NumberFormat />
|
79
|
+
</Style>
|
80
|
+
<Style ss:ID=".font.italic">
|
81
|
+
<Font ss:Italic="1" />
|
82
|
+
<NumberFormat />
|
83
|
+
</Style>
|
84
|
+
<Style ss:ID=".font.sizeA">
|
85
|
+
<Font ss:Size="6" />
|
86
|
+
<NumberFormat />
|
87
|
+
</Style>
|
88
|
+
<Style ss:ID=".font.sizeB">
|
89
|
+
<Font ss:Size="14" />
|
90
|
+
<NumberFormat />
|
91
|
+
</Style>
|
92
|
+
<Style ss:ID=".font.colorA">
|
93
|
+
<Font ss:Color="#FF0000" />
|
94
|
+
<NumberFormat />
|
95
|
+
</Style>
|
96
|
+
<Style ss:ID=".font.colorB">
|
97
|
+
<Font ss:Color="#00FF00" />
|
98
|
+
<NumberFormat />
|
99
|
+
</Style>
|
100
|
+
<Style ss:ID=".font.nameA">
|
101
|
+
<Font ss:FontName="Courier" />
|
102
|
+
<NumberFormat />
|
103
|
+
</Style>
|
104
|
+
<Style ss:ID=".font.nameB">
|
105
|
+
<Font ss:FontName="Times New Roman" />
|
106
|
+
<NumberFormat />
|
107
|
+
</Style>
|
108
|
+
<Style ss:ID=".bg.color">
|
109
|
+
<Font ss:Color="#FFFFFF" />
|
110
|
+
<Interior ss:Color="#FF0000" ss:Pattern="Solid" />
|
111
|
+
<NumberFormat />
|
112
|
+
</Style>
|
113
|
+
<Style ss:ID=".bg.pattern">
|
114
|
+
<Interior ss:Pattern="HorzStripe" />
|
115
|
+
<NumberFormat />
|
116
|
+
</Style>
|
117
|
+
<Style ss:ID=".bg.pattern.color">
|
118
|
+
<Font ss:Color="#FFFFFF" />
|
119
|
+
<Interior ss:Color="#FF0000" ss:Pattern="HorzStripe" ss:PatternColor="#000000" />
|
120
|
+
<NumberFormat />
|
121
|
+
</Style>
|
122
|
+
<Style ss:ID=".border.top.color.weight.style">
|
123
|
+
<Borders>
|
124
|
+
<Border ss:Color="#FF0000" ss:LineStyle="Continuous" ss:Position="Top" ss:Weight="0" />
|
125
|
+
</Borders>
|
126
|
+
<NumberFormat />
|
127
|
+
</Style>
|
128
|
+
<Style ss:ID=".border.right.color.weight.style">
|
129
|
+
<Borders>
|
130
|
+
<Border ss:Color="#00FF00" ss:LineStyle="Dash" ss:Position="Right" ss:Weight="1" />
|
131
|
+
</Borders>
|
132
|
+
<NumberFormat />
|
133
|
+
</Style>
|
134
|
+
<Style ss:ID=".border.bottom.color.weight.style">
|
135
|
+
<Borders>
|
136
|
+
<Border ss:Color="#0000FF" ss:LineStyle="Dot" ss:Position="Bottom" ss:Weight="2" />
|
137
|
+
</Borders>
|
138
|
+
<NumberFormat />
|
139
|
+
</Style>
|
140
|
+
<Style ss:ID=".border.left.color.weight.style">
|
141
|
+
<Borders>
|
142
|
+
<Border ss:Color="#FFFF00" ss:LineStyle="DashDot" ss:Position="Left" ss:Weight="3" />
|
143
|
+
</Borders>
|
144
|
+
<NumberFormat />
|
145
|
+
</Style>
|
146
|
+
<Style ss:ID=".border.all">
|
147
|
+
<Borders>
|
148
|
+
<Border ss:Color="#00FFFF" ss:LineStyle="Continuous" ss:Position="Top" ss:Weight="3" />
|
149
|
+
<Border ss:Color="#00FFFF" ss:LineStyle="Continuous" ss:Position="Right" ss:Weight="3" />
|
150
|
+
<Border ss:Color="#00FFFF" ss:LineStyle="Continuous" ss:Position="Bottom" ss:Weight="3" />
|
151
|
+
<Border ss:Color="#00FFFF" ss:LineStyle="Continuous" ss:Position="Left" ss:Weight="3" />
|
152
|
+
</Borders>
|
153
|
+
<NumberFormat />
|
154
|
+
</Style>
|
155
|
+
</Styles>
|
156
|
+
<Worksheet ss:Name="align">
|
157
|
+
<Table>
|
158
|
+
<Column ss:Width="100" />
|
159
|
+
<Column ss:Width="100" />
|
160
|
+
<Column ss:Width="100" />
|
161
|
+
<Column ss:Width="100" />
|
162
|
+
<Row ss:Height="50">
|
163
|
+
<Cell ss:StyleID=".align.rotA">
|
164
|
+
<Data ss:Type="String">rotA</Data>
|
165
|
+
</Cell>
|
166
|
+
<Cell ss:StyleID=".align.rotB">
|
167
|
+
<Data ss:Type="String">rotB</Data>
|
168
|
+
</Cell>
|
169
|
+
<Cell ss:StyleID=".align.rotC">
|
170
|
+
<Data ss:Type="String">rotC</Data>
|
171
|
+
</Cell>
|
172
|
+
</Row>
|
173
|
+
<Row ss:Height="50">
|
174
|
+
<Cell ss:StyleID=".align.top">
|
175
|
+
<Data ss:Type="String">top</Data>
|
176
|
+
</Cell>
|
177
|
+
<Cell ss:StyleID=".align.middle">
|
178
|
+
<Data ss:Type="String">middle</Data>
|
179
|
+
</Cell>
|
180
|
+
<Cell ss:StyleID=".align.bottom">
|
181
|
+
<Data ss:Type="String">bottom</Data>
|
182
|
+
</Cell>
|
183
|
+
</Row>
|
184
|
+
<Row ss:Height="50">
|
185
|
+
<Cell ss:StyleID=".align.wrap">
|
186
|
+
<Data ss:Type="String">wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap </Data>
|
187
|
+
</Cell>
|
188
|
+
</Row>
|
189
|
+
<Row ss:Height="50">
|
190
|
+
<Cell ss:StyleID=".align.left">
|
191
|
+
<Data ss:Type="String">left</Data>
|
192
|
+
</Cell>
|
193
|
+
<Cell ss:StyleID=".align.center">
|
194
|
+
<Data ss:Type="String">center</Data>
|
195
|
+
</Cell>
|
196
|
+
<Cell ss:StyleID=".align.right">
|
197
|
+
<Data ss:Type="String">right</Data>
|
198
|
+
</Cell>
|
199
|
+
</Row>
|
200
|
+
</Table>
|
201
|
+
</Worksheet>
|
202
|
+
<Worksheet ss:Name="font">
|
203
|
+
<Table>
|
204
|
+
<Column ss:Width="100" />
|
205
|
+
<Column ss:Width="100" />
|
206
|
+
<Column ss:Width="100" />
|
207
|
+
<Column ss:Width="100" />
|
208
|
+
<Column ss:Width="100" />
|
209
|
+
<Column ss:Width="100" />
|
210
|
+
<Row>
|
211
|
+
<Cell ss:StyleID=".font.underline">
|
212
|
+
<Data ss:Type="String">underline</Data>
|
213
|
+
</Cell>
|
214
|
+
<Cell ss:StyleID=".font.double_underline">
|
215
|
+
<Data ss:Type="String">double_underline</Data>
|
216
|
+
</Cell>
|
217
|
+
<Cell ss:StyleID=".font.accounting_underline">
|
218
|
+
<Data ss:Type="String">accounting_underline</Data>
|
219
|
+
</Cell>
|
220
|
+
<Cell ss:StyleID=".font.double_accounting_underline">
|
221
|
+
<Data ss:Type="String">double_accounting_underline</Data>
|
222
|
+
</Cell>
|
223
|
+
</Row>
|
224
|
+
<Row>
|
225
|
+
<Cell ss:StyleID=".font.subscript">
|
226
|
+
<Data ss:Type="String">subscript</Data>
|
227
|
+
</Cell>
|
228
|
+
<Cell ss:StyleID=".font.superscript">
|
229
|
+
<Data ss:Type="String">superscript</Data>
|
230
|
+
</Cell>
|
231
|
+
<Cell ss:StyleID=".font.strikethrough">
|
232
|
+
<Data ss:Type="String">strikethrough</Data>
|
233
|
+
</Cell>
|
234
|
+
<Cell ss:StyleID=".font.shadow">
|
235
|
+
<Data ss:Type="String">shadow</Data>
|
236
|
+
</Cell>
|
237
|
+
</Row>
|
238
|
+
<Row>
|
239
|
+
<Cell ss:StyleID=".font.bold">
|
240
|
+
<Data ss:Type="String">bold</Data>
|
241
|
+
</Cell>
|
242
|
+
<Cell ss:StyleID=".font.italic">
|
243
|
+
<Data ss:Type="String">italic</Data>
|
244
|
+
</Cell>
|
245
|
+
</Row>
|
246
|
+
<Row>
|
247
|
+
<Cell ss:StyleID=".font.sizeA">
|
248
|
+
<Data ss:Type="String">sizeA</Data>
|
249
|
+
</Cell>
|
250
|
+
<Cell ss:StyleID=".font.sizeB">
|
251
|
+
<Data ss:Type="String">sizeB</Data>
|
252
|
+
</Cell>
|
253
|
+
</Row>
|
254
|
+
<Row>
|
255
|
+
<Cell ss:StyleID=".font.colorA">
|
256
|
+
<Data ss:Type="String">colorA</Data>
|
257
|
+
</Cell>
|
258
|
+
<Cell ss:StyleID=".font.colorB">
|
259
|
+
<Data ss:Type="String">colorB</Data>
|
260
|
+
</Cell>
|
261
|
+
</Row>
|
262
|
+
<Row>
|
263
|
+
<Cell ss:StyleID=".font.nameA">
|
264
|
+
<Data ss:Type="String">nameA</Data>
|
265
|
+
</Cell>
|
266
|
+
<Cell ss:StyleID=".font.nameB">
|
267
|
+
<Data ss:Type="String">nameB</Data>
|
268
|
+
</Cell>
|
269
|
+
</Row>
|
270
|
+
</Table>
|
271
|
+
</Worksheet>
|
272
|
+
<Worksheet ss:Name="bg">
|
273
|
+
<Table>
|
274
|
+
<Column ss:Width="100" />
|
275
|
+
<Row ss:Height="50">
|
276
|
+
<Cell ss:StyleID=".bg.color">
|
277
|
+
<Data ss:Type="String">COLOR</Data>
|
278
|
+
</Cell>
|
279
|
+
</Row>
|
280
|
+
<Row ss:Height="50">
|
281
|
+
<Cell ss:StyleID=".bg.pattern">
|
282
|
+
<Data ss:Type="String">PATTERN</Data>
|
283
|
+
</Cell>
|
284
|
+
</Row>
|
285
|
+
<Row ss:Height="50">
|
286
|
+
<Cell ss:StyleID=".bg.pattern.color">
|
287
|
+
<Data ss:Type="String">PATTERN COLOR</Data>
|
288
|
+
</Cell>
|
289
|
+
</Row>
|
290
|
+
</Table>
|
291
|
+
</Worksheet>
|
292
|
+
<Worksheet ss:Name="border">
|
293
|
+
<Table>
|
294
|
+
<Column ss:Width="20" />
|
295
|
+
<Column ss:Width="200" />
|
296
|
+
<Row />
|
297
|
+
<Row ss:Height="50">
|
298
|
+
<Cell>
|
299
|
+
<Data ss:Type="String"></Data>
|
300
|
+
</Cell>
|
301
|
+
<Cell ss:StyleID=".border.top.color.weight.style">
|
302
|
+
<Data ss:Type="String">top red hairline continuous</Data>
|
303
|
+
</Cell>
|
304
|
+
</Row>
|
305
|
+
<Row />
|
306
|
+
<Row ss:Height="50">
|
307
|
+
<Cell>
|
308
|
+
<Data ss:Type="String"></Data>
|
309
|
+
</Cell>
|
310
|
+
<Cell ss:StyleID=".border.right.color.weight.style">
|
311
|
+
<Data ss:Type="String">right green thin dash</Data>
|
312
|
+
</Cell>
|
313
|
+
</Row>
|
314
|
+
<Row />
|
315
|
+
<Row ss:Height="50">
|
316
|
+
<Cell>
|
317
|
+
<Data ss:Type="String"></Data>
|
318
|
+
</Cell>
|
319
|
+
<Cell ss:StyleID=".border.bottom.color.weight.style">
|
320
|
+
<Data ss:Type="String">bottom blue medium dat</Data>
|
321
|
+
</Cell>
|
322
|
+
</Row>
|
323
|
+
<Row />
|
324
|
+
<Row ss:Height="50">
|
325
|
+
<Cell>
|
326
|
+
<Data ss:Type="String"></Data>
|
327
|
+
</Cell>
|
328
|
+
<Cell ss:StyleID=".border.left.color.weight.style">
|
329
|
+
<Data ss:Type="String">left yellow thick dast_dot</Data>
|
330
|
+
</Cell>
|
331
|
+
</Row>
|
332
|
+
<Row />
|
333
|
+
<Row ss:Height="50">
|
334
|
+
<Cell>
|
335
|
+
<Data ss:Type="String"></Data>
|
336
|
+
</Cell>
|
337
|
+
<Cell ss:StyleID=".border.all">
|
338
|
+
<Data ss:Type="String">all aqua</Data>
|
339
|
+
</Cell>
|
340
|
+
</Row>
|
341
|
+
</Table>
|
342
|
+
</Worksheet>
|
343
|
+
</Workbook>
|
data/examples/trivial.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# To run:
|
2
|
+
# $ bundle install
|
3
|
+
# $ bundle exec ruby examples/trivial.rb
|
4
|
+
# $ open examples/trivial.xls
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'osheet/xmlss'
|
8
|
+
|
9
|
+
puts "building examples/trivial.rb ..."
|
10
|
+
|
11
|
+
Osheet::Workbook.new(Osheet::XmlssWriter.new(:pp => 2)) {
|
12
|
+
title "basic"
|
13
|
+
worksheet {
|
14
|
+
name "one dollar"
|
15
|
+
column
|
16
|
+
row {
|
17
|
+
cell {
|
18
|
+
data 1
|
19
|
+
format :currency
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}.to_file('examples/trivial.xls')
|
24
|
+
|
25
|
+
puts "open examples/trivial.xls"
|