osheet 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ require 'ruby-prof'
2
+ require 'osheet'
3
+
4
+ class OsheetProfilerRunner
5
+
6
+ attr_reader :result
7
+
8
+ def initialize(n)
9
+
10
+ @result = RubyProf.profile do
11
+ Osheet::Workbook.new {
12
+ title "basic"
13
+ worksheet {
14
+ name "one dollar"
15
+ 5.times { column }
16
+
17
+ 1000.times do
18
+ row {
19
+ [1, "text", 123.45, "0001267", "$45.23"].each do |data_value|
20
+ cell { data data_value }
21
+ end
22
+ }
23
+ end
24
+ }
25
+ }.to_file('./bench/profiler_1000.xls', :pp => 2)
26
+ end
27
+
28
+ end
29
+
30
+ def print_flat(outstream, opts={})
31
+ RubyProf::FlatPrinter.new(@result).print(outstream, opts)
32
+ #RubyProf::GraphPrinter.new(@result).print(outstream, opts)
33
+ end
34
+
35
+ def print_graph(outstream, opts={})
36
+ RubyProf::GraphPrinter.new(@result).print(outstream, opts)
37
+ end
38
+
39
+ end
data/examples/basic.rb CHANGED
@@ -15,6 +15,7 @@ data = {
15
15
 
16
16
  # this will dump the above data to a single-sheet workbook w/ no styles
17
17
 
18
+ puts "building examples/basic.rb ..."
18
19
 
19
20
  Osheet::Workbook.new {
20
21
  title "basic"
@@ -70,4 +71,7 @@ Osheet::Workbook.new {
70
71
  }
71
72
  end
72
73
  }
73
- }.to_file('examples/basic.xls')
74
+ }.to_file('examples/basic.xls')
75
+
76
+ puts "open examples/basic.xls"
77
+
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"><Styles></Styles><Worksheet ss:Name="Stats Sex, Age, Height, Weight"><Table><Column ss:Width="200" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Column ss:Width="80" /><Row><Cell ss:MergeAcross="4"><Data ss:Type="String">Stats: Sex, Age, Height, Weight</Data></Cell></Row><Row><Cell ss:MergeAcross="4"><Data ss:Type="String"></Data></Cell></Row><Row><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Sex</Data></Cell><Cell><Data ss:Type="String">Age</Data></Cell><Cell><Data ss:Type="String">Height</Data></Cell><Cell><Data ss:Type="String">Weight</Data></Cell></Row><Row><Cell><Data ss:Type="String">Sally</Data></Cell><Cell><Data ss:Type="String">F</Data></Cell><Cell><Data ss:Type="Number">29</Data></Cell><Cell><Data ss:Type="String">5'3"</Data></Cell><Cell><Data ss:Type="String">132 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Dick</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">33</Data></Cell><Cell><Data ss:Type="String">6'5"</Data></Cell><Cell><Data ss:Type="String">243 lbs.</Data></Cell></Row><Row><Cell><Data ss:Type="String">Tom</Data></Cell><Cell><Data ss:Type="String">M</Data></Cell><Cell><Data ss:Type="Number">52</Data></Cell><Cell><Data ss:Type="String">6'2"</Data></Cell><Cell><Data ss:Type="String">220 lbs.</Data></Cell></Row></Table></Worksheet></Workbook>
@@ -15,6 +15,7 @@ data = {
15
15
 
16
16
  # this will dump the above data to a single-sheet workbook w/ no styles
17
17
 
18
+ puts "building examples/basic_with_templats.rb ..."
18
19
 
19
20
  Osheet::Workbook.new {
20
21
  title "basic"
@@ -81,4 +82,6 @@ Osheet::Workbook.new {
81
82
  row :data, name, stats
82
83
  end
83
84
  }
84
- }.to_file('examples/basic_with_templates.xls', :format)
85
+ }.to_file('examples/basic_with_templates.xls', :pp => 2)
86
+
87
+ puts "open examples/basic_with_templates.xls"
@@ -0,0 +1,93 @@
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="Stats Sex, Age, Height, Weight">
7
+ <Table>
8
+ <Column ss:Width="200" />
9
+ <Column ss:Width="80" />
10
+ <Column ss:Width="80" />
11
+ <Column ss:Width="80" />
12
+ <Column ss:Width="80" />
13
+ <Row>
14
+ <Cell ss:MergeAcross="4">
15
+ <Data ss:Type="String">Stats: Sex, Age, Height, Weight</Data>
16
+ </Cell>
17
+ </Row>
18
+ <Row>
19
+ <Cell ss:MergeAcross="4">
20
+ <Data ss:Type="String"></Data>
21
+ </Cell>
22
+ </Row>
23
+ <Row>
24
+ <Cell>
25
+ <Data ss:Type="String">Name</Data>
26
+ </Cell>
27
+ <Cell>
28
+ <Data ss:Type="String">Sex</Data>
29
+ </Cell>
30
+ <Cell>
31
+ <Data ss:Type="String">Age</Data>
32
+ </Cell>
33
+ <Cell>
34
+ <Data ss:Type="String">Height</Data>
35
+ </Cell>
36
+ <Cell>
37
+ <Data ss:Type="String">Weight</Data>
38
+ </Cell>
39
+ </Row>
40
+ <Row>
41
+ <Cell>
42
+ <Data ss:Type="String">Sally</Data>
43
+ </Cell>
44
+ <Cell>
45
+ <Data ss:Type="String">F</Data>
46
+ </Cell>
47
+ <Cell>
48
+ <Data ss:Type="Number">29</Data>
49
+ </Cell>
50
+ <Cell>
51
+ <Data ss:Type="String">5'3"</Data>
52
+ </Cell>
53
+ <Cell>
54
+ <Data ss:Type="String">132 lbs.</Data>
55
+ </Cell>
56
+ </Row>
57
+ <Row>
58
+ <Cell>
59
+ <Data ss:Type="String">Dick</Data>
60
+ </Cell>
61
+ <Cell>
62
+ <Data ss:Type="String">M</Data>
63
+ </Cell>
64
+ <Cell>
65
+ <Data ss:Type="Number">33</Data>
66
+ </Cell>
67
+ <Cell>
68
+ <Data ss:Type="String">6'5"</Data>
69
+ </Cell>
70
+ <Cell>
71
+ <Data ss:Type="String">243 lbs.</Data>
72
+ </Cell>
73
+ </Row>
74
+ <Row>
75
+ <Cell>
76
+ <Data ss:Type="String">Tom</Data>
77
+ </Cell>
78
+ <Cell>
79
+ <Data ss:Type="String">M</Data>
80
+ </Cell>
81
+ <Cell>
82
+ <Data ss:Type="Number">52</Data>
83
+ </Cell>
84
+ <Cell>
85
+ <Data ss:Type="String">6'2"</Data>
86
+ </Cell>
87
+ <Cell>
88
+ <Data ss:Type="String">220 lbs.</Data>
89
+ </Cell>
90
+ </Row>
91
+ </Table>
92
+ </Worksheet>
93
+ </Workbook>
data/examples/formats.rb CHANGED
@@ -6,6 +6,8 @@
6
6
  require 'rubygems'
7
7
  require 'osheet'
8
8
 
9
+ puts "building examples/formats.rb ..."
10
+
9
11
  Osheet::Workbook.new {
10
12
  title "formats"
11
13
 
@@ -363,4 +365,6 @@ Osheet::Workbook.new {
363
365
 
364
366
 
365
367
 
366
- }.to_file('examples/formats.xls', :format)
368
+ }.to_file('examples/formats.xls', :pp => 2)
369
+
370
+ puts "open examples/formats.xls"