surpass 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/History.txt +4 -0
  2. data/README.txt +3 -20
  3. data/Rakefile +2 -13
  4. data/bin/surpass +8 -0
  5. data/examples/big-16mb.rb +25 -0
  6. data/examples/big-random-strings.rb +28 -0
  7. data/examples/blanks.rb +34 -0
  8. data/examples/blanks.xls +0 -0
  9. data/examples/col_width.rb +16 -0
  10. data/examples/col_width.xls +0 -0
  11. data/examples/dates.rb +31 -0
  12. data/examples/dates.xls +0 -0
  13. data/examples/format.rb +23 -0
  14. data/examples/format.xls +0 -0
  15. data/examples/hello-world.rb +9 -0
  16. data/examples/hello-world.xls +0 -0
  17. data/examples/image.rb +10 -0
  18. data/examples/image.xls +0 -0
  19. data/examples/merged.rb +36 -0
  20. data/examples/merged.xls +0 -0
  21. data/examples/merged0.rb +27 -0
  22. data/examples/merged0.xls +0 -0
  23. data/examples/merged1.rb +99 -0
  24. data/examples/merged1.xls +0 -0
  25. data/examples/num_formats.rb +55 -0
  26. data/examples/num_formats.xls +0 -0
  27. data/examples/numbers.rb +24 -0
  28. data/examples/numbers.xls +0 -0
  29. data/examples/outline.rb +110 -0
  30. data/examples/outline.xls +0 -0
  31. data/examples/panes.rb +48 -0
  32. data/examples/panes.xls +0 -0
  33. data/examples/protection.rb +132 -0
  34. data/examples/protection.xls +0 -0
  35. data/examples/python.bmp +0 -0
  36. data/examples/row_styles.rb +16 -0
  37. data/examples/row_styles.xls +0 -0
  38. data/examples/row_styles_empty.rb +15 -0
  39. data/examples/row_styles_empty.xls +0 -0
  40. data/examples/set_cell_and_range_style.rb +12 -0
  41. data/examples/set_cell_and_range_style.xls +0 -0
  42. data/examples/wrapped-text.rb +13 -0
  43. data/examples/wrapped-text.xls +0 -0
  44. data/examples/write_arrays.rb +22 -0
  45. data/examples/write_arrays.xls +0 -0
  46. data/examples/ws_props.rb +80 -0
  47. data/lib/surpass/ExcelFormula.g +366 -0
  48. data/lib/surpass/ExcelFormula.tokens +30 -0
  49. data/lib/surpass/ExcelFormulaLexer.rb +922 -0
  50. data/lib/surpass/ExcelFormulaParser.rb +602 -0
  51. data/lib/{biff_record.rb → surpass/biff_record.rb} +0 -0
  52. data/lib/{bitmap.rb → surpass/bitmap.rb} +0 -0
  53. data/lib/{cell.rb → surpass/cell.rb} +2 -34
  54. data/lib/{chart.rb → surpass/chart.rb} +0 -0
  55. data/lib/{column.rb → surpass/column.rb} +0 -0
  56. data/lib/{document.rb → surpass/document.rb} +0 -0
  57. data/lib/surpass/excel_formula.rb +23 -0
  58. data/lib/{excel_magic.rb → surpass/excel_magic.rb} +0 -0
  59. data/lib/{formatting.rb → surpass/formatting.rb} +93 -53
  60. data/lib/{row.rb → surpass/row.rb} +0 -0
  61. data/lib/{style.rb → surpass/style.rb} +2 -1
  62. data/lib/surpass/tokens.txt +2 -0
  63. data/lib/{utilities.rb → surpass/utilities.rb} +0 -0
  64. data/lib/{workbook.rb → surpass/workbook.rb} +0 -0
  65. data/lib/{worksheet.rb → surpass/worksheet.rb} +15 -6
  66. data/lib/surpass.rb +1 -1
  67. data/spec/biff_record_spec.rb +268 -0
  68. data/spec/cell_spec.rb +56 -0
  69. data/spec/data/random-strings.txt +10000 -0
  70. data/spec/document_spec.rb +168 -0
  71. data/spec/excel_formula_spec.rb +27 -0
  72. data/spec/formatting_spec.rb +53 -0
  73. data/spec/output/cells-rk.xls +0 -0
  74. data/spec/output/cells.xls +0 -0
  75. data/spec/output/mini.xls +0 -0
  76. data/spec/reference/P-0508-0000507647-3280-5298.xls +0 -0
  77. data/spec/reference/all-cell-styles.bin +0 -0
  78. data/spec/reference/all-number-formats.bin +0 -0
  79. data/spec/reference/all-styles.bin +0 -0
  80. data/spec/reference/mini.xls +0 -0
  81. data/spec/row_spec.rb +19 -0
  82. data/spec/spec_helper.rb +10 -0
  83. data/spec/style_spec.rb +89 -0
  84. data/spec/surpass_spec.rb +7 -0
  85. data/spec/utilities_spec.rb +57 -0
  86. data/spec/workbook_spec.rb +48 -0
  87. data/spec/worksheet_spec.rb +0 -0
  88. data/stats/cloc.txt +8 -0
  89. data/stats/rcov.txt +0 -0
  90. data/stats/specdoc.txt +158 -0
  91. data/surpass.gemspec +40 -0
  92. data/tasks/setup.rb +1 -1
  93. data/tasks/zentest.rake +36 -0
  94. data/webby/README.txt +6 -0
  95. data/webby/Sitefile +43 -0
  96. data/webby/content/css/pygments.txt +6 -0
  97. data/webby/content/css/style.css +279 -0
  98. data/webby/content/examples/autoformat.png +0 -0
  99. data/webby/content/examples/autoformat.rb +32 -0
  100. data/webby/content/examples/autoformat.xls +0 -0
  101. data/webby/content/examples/borders.png +0 -0
  102. data/webby/content/examples/borders.rb +15 -0
  103. data/webby/content/examples/borders.xls +0 -0
  104. data/webby/content/examples/colours.png +0 -0
  105. data/webby/content/examples/colours.rb +23 -0
  106. data/webby/content/examples/colours.xls +0 -0
  107. data/webby/content/examples/data.png +0 -0
  108. data/webby/content/examples/data.rb +11 -0
  109. data/webby/content/examples/data.xls +0 -0
  110. data/webby/content/examples/formatting.png +0 -0
  111. data/webby/content/examples/formatting.rb +78 -0
  112. data/webby/content/examples/formatting.xls +0 -0
  113. data/webby/content/examples/hello-world.png +0 -0
  114. data/webby/content/examples/hello-world.py +8 -0
  115. data/webby/content/examples/hello-world.rb +9 -0
  116. data/webby/content/examples/hello-world.xls +0 -0
  117. data/webby/content/examples/number-format-string.png +0 -0
  118. data/webby/content/examples/number-format-string.rb +14 -0
  119. data/webby/content/examples/number-format-string.xls +0 -0
  120. data/webby/content/examples/patterns.png +0 -0
  121. data/webby/content/examples/patterns.rb +26 -0
  122. data/webby/content/examples/patterns.xls +0 -0
  123. data/webby/content/examples/show-greens.sh +1 -0
  124. data/webby/content/examples/surpass-info.sh +1 -0
  125. data/webby/content/img/Thumbs.db +0 -0
  126. data/webby/content/img/bg_menu.gif +0 -0
  127. data/webby/content/img/bg_t.gif +0 -0
  128. data/webby/content/img/bullet.gif +0 -0
  129. data/webby/content/img/logo.png +0 -0
  130. data/webby/content/img/logo_.jpg +0 -0
  131. data/webby/content/img/top_bg.gif +0 -0
  132. data/webby/content/img/top_bg_.gif +0 -0
  133. data/webby/content/index.txt +16 -0
  134. data/webby/content/installation/index.txt +24 -0
  135. data/webby/content/source/ExcelFormulaLexer.txt +7 -0
  136. data/webby/content/source/ExcelFormulaParser.txt +7 -0
  137. data/webby/content/source/biff_record.txt +7 -0
  138. data/webby/content/source/bitmap.txt +7 -0
  139. data/webby/content/source/cell.txt +7 -0
  140. data/webby/content/source/chart.txt +7 -0
  141. data/webby/content/source/column.txt +7 -0
  142. data/webby/content/source/document.txt +7 -0
  143. data/webby/content/source/excel_formula.txt +7 -0
  144. data/webby/content/source/excel_magic.txt +7 -0
  145. data/webby/content/source/formatting.txt +7 -0
  146. data/webby/content/source/row.txt +7 -0
  147. data/webby/content/source/style.txt +7 -0
  148. data/webby/content/source/utilities.txt +7 -0
  149. data/webby/content/source/workbook.txt +7 -0
  150. data/webby/content/source/worksheet.txt +7 -0
  151. data/webby/content/surpass-manual.erb +198 -0
  152. data/webby/layouts/book.txt +29 -0
  153. data/webby/layouts/default.txt +27 -0
  154. data/webby/layouts/two_column.txt +25 -0
  155. data/webby/layouts/web.txt +66 -0
  156. data/webby/output/.cairn +0 -0
  157. data/webby/output/css/blueprint/ie.css +26 -0
  158. data/webby/output/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  159. data/webby/output/css/blueprint/plugins/buttons/icons/key.png +0 -0
  160. data/webby/output/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  161. data/webby/output/css/blueprint/plugins/buttons/readme.txt +32 -0
  162. data/webby/output/css/blueprint/plugins/buttons/screen.css +97 -0
  163. data/webby/output/css/blueprint/plugins/fancy-type/readme.txt +14 -0
  164. data/webby/output/css/blueprint/plugins/fancy-type/screen.css +71 -0
  165. data/webby/output/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
  166. data/webby/output/css/blueprint/plugins/link-icons/icons/email.png +0 -0
  167. data/webby/output/css/blueprint/plugins/link-icons/icons/external.png +0 -0
  168. data/webby/output/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
  169. data/webby/output/css/blueprint/plugins/link-icons/icons/im.png +0 -0
  170. data/webby/output/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  171. data/webby/output/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
  172. data/webby/output/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
  173. data/webby/output/css/blueprint/plugins/link-icons/readme.txt +18 -0
  174. data/webby/output/css/blueprint/plugins/link-icons/screen.css +40 -0
  175. data/webby/output/css/blueprint/plugins/rtl/readme.txt +10 -0
  176. data/webby/output/css/blueprint/plugins/rtl/screen.css +109 -0
  177. data/webby/output/css/blueprint/print.css +30 -0
  178. data/webby/output/css/blueprint/screen.css +251 -0
  179. data/webby/output/css/blueprint/src/forms.css +49 -0
  180. data/webby/output/css/blueprint/src/grid.css +212 -0
  181. data/webby/output/css/blueprint/src/grid.png +0 -0
  182. data/webby/output/css/blueprint/src/ie.css +59 -0
  183. data/webby/output/css/blueprint/src/print.css +85 -0
  184. data/webby/output/css/blueprint/src/reset.css +38 -0
  185. data/webby/output/css/blueprint/src/typography.css +105 -0
  186. data/webby/output/css/pygments.css +59 -0
  187. data/webby/output/css/site.css +62 -0
  188. data/webby/output/css/style.css +279 -0
  189. data/webby/output/examples/autoformat.png +0 -0
  190. data/webby/output/examples/autoformat.rb +32 -0
  191. data/webby/output/examples/autoformat.xls +0 -0
  192. data/webby/output/examples/borders.png +0 -0
  193. data/webby/output/examples/borders.rb +15 -0
  194. data/webby/output/examples/borders.xls +0 -0
  195. data/webby/output/examples/colours.png +0 -0
  196. data/webby/output/examples/colours.rb +23 -0
  197. data/webby/output/examples/colours.xls +0 -0
  198. data/webby/output/examples/data.png +0 -0
  199. data/webby/output/examples/data.rb +11 -0
  200. data/webby/output/examples/data.xls +0 -0
  201. data/webby/output/examples/formatting.png +0 -0
  202. data/webby/output/examples/formatting.rb +78 -0
  203. data/webby/output/examples/formatting.xls +0 -0
  204. data/webby/output/examples/hello-world.png +0 -0
  205. data/webby/output/examples/hello-world.py +8 -0
  206. data/webby/output/examples/hello-world.rb +9 -0
  207. data/webby/output/examples/hello-world.xls +0 -0
  208. data/webby/output/examples/number-format-string.png +0 -0
  209. data/webby/output/examples/number-format-string.rb +14 -0
  210. data/webby/output/examples/number-format-string.xls +0 -0
  211. data/webby/output/examples/patterns.png +0 -0
  212. data/webby/output/examples/patterns.rb +26 -0
  213. data/webby/output/examples/patterns.xls +0 -0
  214. data/webby/output/examples/show-greens.sh +1 -0
  215. data/webby/output/examples/surpass-info.sh +1 -0
  216. data/webby/output/img/Thumbs.db +0 -0
  217. data/webby/output/img/bg_menu.gif +0 -0
  218. data/webby/output/img/bg_t.gif +0 -0
  219. data/webby/output/img/bullet.gif +0 -0
  220. data/webby/output/img/logo.png +0 -0
  221. data/webby/output/img/logo_.jpg +0 -0
  222. data/webby/output/img/top_bg.gif +0 -0
  223. data/webby/output/img/top_bg_.gif +0 -0
  224. data/webby/output/index.html +138 -0
  225. data/webby/output/installation/index.html +64 -0
  226. data/webby/output/installation/installation.html +1 -0
  227. data/webby/output/installation.html +1 -0
  228. data/webby/output/source/ExcelFormulaLexer.html +981 -0
  229. data/webby/output/source/ExcelFormulaParser.html +661 -0
  230. data/webby/output/source/biff_record.html +462 -0
  231. data/webby/output/source/bitmap.html +277 -0
  232. data/webby/output/source/cell.html +241 -0
  233. data/webby/output/source/chart.html +64 -0
  234. data/webby/output/source/column.html +99 -0
  235. data/webby/output/source/document.html +465 -0
  236. data/webby/output/source/excel_formula.html +82 -0
  237. data/webby/output/source/excel_magic.html +1072 -0
  238. data/webby/output/source/formatting.html +664 -0
  239. data/webby/output/source/row.html +169 -0
  240. data/webby/output/source/style.html +158 -0
  241. data/webby/output/source/surpass.html +110 -0
  242. data/webby/output/source/utilities.html +145 -0
  243. data/webby/output/source/workbook.html +265 -0
  244. data/webby/output/source/worksheet.html +331 -0
  245. data/webby/output/surpass-manual-0-0-5.pdf +0 -0
  246. data/webby/output/surpass-manual.aux +50 -0
  247. data/webby/output/surpass-manual.log +366 -0
  248. data/webby/output/surpass-manual.out +20 -0
  249. data/webby/output/surpass-manual.tex +582 -0
  250. data/webby/output/surpass-manual.toc +20 -0
  251. data/webby/rsync-exclude +7 -0
  252. data/webby/tasks/latex.rake +14 -0
  253. data/webby/tasks/screenshots.rb +58 -0
  254. data/webby/templates/article.erb +15 -0
  255. data/webby/templates/book.erb +16 -0
  256. data/webby/templates/page.erb +9 -0
  257. metadata +302 -24
  258. data/bin/surpass-info +0 -20
  259. data/lib/excel_formula.rb +0 -6
data/History.txt CHANGED
@@ -0,0 +1,4 @@
1
+ == 1.0.0 / 2009-10-27
2
+
3
+ * 1 major enhancement
4
+ * Birthday!
data/README.txt CHANGED
@@ -1,22 +1,7 @@
1
1
  surpass
2
- by Ana Nelson, based on original Python code by Roman V. Kiseliov
3
-
4
- == WEBSITES:
5
-
6
- Project Home:
7
- http://surpass.rubyforge.org
8
-
9
- Code Repository:
10
- bzr branch http://ananelson.com/code/surpass
11
-
12
- You'll need to have the Bazaar version control system. This is very easy to install on any platform: http://bazaar-vcs.org
13
-
14
- Issue Tracker:
15
- http://launchpad.net/surpass
16
-
17
- Discussions:
18
- http://groups.google.com/group/ruby-excel
19
-
2
+ by Ana Nelson
3
+ http://ananelson.com
4
+ Based on original Python code by Roman V. Kiseliov
20
5
 
21
6
  == DESCRIPTION:
22
7
 
@@ -26,7 +11,6 @@ For comprehensive documentation, please refer to the PDF manual which is availab
26
11
 
27
12
  If you like to learn from playing with working examples, then there are plenty in the examples/ and webby/examples directories of the source code.
28
13
 
29
-
30
14
  == REQUIREMENTS:
31
15
 
32
16
  Tested with Ruby 1.8.6 (MRI or JRuby)
@@ -37,7 +21,6 @@ This is just standard Ruby, so please feel free to try on other Ruby platforms a
37
21
 
38
22
  sudo gem install surpass
39
23
 
40
-
41
24
  == LICENSE:
42
25
 
43
26
  Please see LICENSE.txt in this directory.
data/Rakefile CHANGED
@@ -21,21 +21,10 @@ task :default => 'spec:run'
21
21
  PROJ.name = 'surpass'
22
22
  PROJ.authors = 'Ana Nelson'
23
23
  PROJ.email = 'ana@ananelson.com'
24
- PROJ.url = 'https://surpass.rubyforge.org'
24
+ PROJ.url = 'http://surpass.rubyforge.org'
25
25
  PROJ.version = Surpass::VERSION
26
26
  PROJ.rubyforge.name = 'surpass'
27
27
 
28
- PROJ.ignore_file = '.bzrignore'
29
-
30
28
  PROJ.spec.opts << '--color'
31
29
 
32
- PROJ.exclude = %w{.bzr webby surpass-manual-* examples spec tasks stats .DS_Store}
33
-
34
- desc "Run all examples (except the big ones) in examples dir."
35
- task :examples do
36
- `ls examples/*.rb`.chomp.split("\n").each_with_index do |f, i|
37
- next if f =~ /big/
38
- puts "processing #{f}..."
39
- `ruby #{f}`
40
- end
41
- end
30
+ # EOF
data/bin/surpass ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(
4
+ File.join(File.dirname(__FILE__), %w[.. lib surpass]))
5
+
6
+ # Put your code here
7
+
8
+ # EOF
@@ -0,0 +1,25 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ s = book.add_sheet('0')
6
+
7
+ colcount = 200 + 1
8
+ rowcount = 6000 + 1
9
+
10
+ start = Time.now
11
+ puts "starting at #{start.to_s}"
12
+
13
+ colcount.times do |c|
14
+ rowcount.times do |r|
15
+ s.write(r, c, "BIG")
16
+ end
17
+ end
18
+
19
+ t = Time.now - start
20
+ puts "time elapsed (writing data to workbook) #{t.to_s}"
21
+
22
+ book.save(__FILE__.gsub(/rb$/, "xls"))
23
+
24
+ t = Time.now - start
25
+ puts "time elapsed (writing workbook to file) #{t.to_s}"
@@ -0,0 +1,28 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ strings = File.read("spec/data/random-strings.txt").split("\n")
5
+
6
+ book = Workbook.new
7
+ s = book.add_sheet('0')
8
+
9
+ colcount = 100 + 1
10
+ rowcount = 100 + 1
11
+
12
+ start = Time.now
13
+ puts "starting at #{start.to_s}"
14
+
15
+ colcount.times do |c|
16
+ rowcount.times do |r|
17
+ i = c * rowcount + r
18
+ s.write(r, c, strings[i])
19
+ end
20
+ end
21
+
22
+ t = Time.now - start
23
+ puts "time elapsed (writing data to workbook) #{t.to_s}"
24
+
25
+ book.save(__FILE__.gsub(/rb$/, "xls"))
26
+
27
+ t = Time.now - start
28
+ puts "time elapsed (writing workbook to file) #{t.to_s}"
@@ -0,0 +1,34 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ font0 = Font.new
5
+ font0.name = 'Times New Roman'
6
+ font0.struck_out = true
7
+ font0.bold = true
8
+
9
+ style0 = StyleFormat.new
10
+ style0.font = font0
11
+
12
+
13
+ book = Workbook.new
14
+ ws0 = book.add_sheet('0')
15
+
16
+ ws0.write(1, 1, 'Test', style0)
17
+
18
+ 0.upto(13) do |i|
19
+ borders = Borders.new
20
+ borders.left = i
21
+ borders.right = i
22
+ borders.top = i
23
+ borders.bottom = i
24
+
25
+ style = StyleFormat.new
26
+ style.borders = borders
27
+
28
+ ws0.write(i, 2, '', style)
29
+ ws0.write(i, 3, hex(i), style0)
30
+ end
31
+
32
+ ws0.write_merge(5, 8, 6, 10, "")
33
+
34
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,16 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws = book.add_sheet('Hey, Dude')
6
+
7
+ (6...80).each do |i|
8
+ fnt = Font.new
9
+ fnt.height = i*20
10
+ style = StyleFormat.new
11
+ style.font = fnt
12
+ ws.write(1, i, 'Test')
13
+ ws.set_column_width(i, i)
14
+ end
15
+
16
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
data/examples/dates.rb ADDED
@@ -0,0 +1,31 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws = book.add_sheet('Hey, Dude')
6
+
7
+ formats = [
8
+ 'M/D/YY',
9
+ 'D-MMM-YY',
10
+ 'D-MMM',
11
+ 'MMM-YY',
12
+ 'h:mm AM/PM',
13
+ 'h:mm:ss AM/PM',
14
+ 'h:mm',
15
+ 'h:mm:ss',
16
+ 'M/D/YY h:mm',
17
+ 'mm:ss',
18
+ '[h]:mm:ss',
19
+ 'mm:ss.0',
20
+ ]
21
+
22
+ formats.each_with_index do |f, i|
23
+ ws.write(i, 0, f)
24
+
25
+ style = StyleFormat.new
26
+ style.number_format_string = f
27
+
28
+ ws.write(i, 4, Time.now, style)
29
+ end
30
+
31
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,23 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ style0 = StyleFormat.new(:font_name => 'Times New Roman', :font_struck_out => true, :font_bold => true)
5
+
6
+ book = Workbook.new
7
+ ws0 = book.add_sheet('0')
8
+
9
+ ws0.write(1, 1, 'Test', style0)
10
+
11
+ (0...14).each do |i|
12
+ style = StyleFormat.new(:font_name => 'Arial', :font_color_index => i, :font_outline => true)
13
+
14
+ borders = Borders.new
15
+ borders.left = i
16
+
17
+ style.borders = borders
18
+
19
+ ws0.write(i, 2, 'colour', style)
20
+ ws0.write(i, 3, hex(i), style0)
21
+ end
22
+
23
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,9 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws = book.add_sheet
6
+
7
+ ws.write(0, 0, "Hello World")
8
+
9
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
data/examples/image.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+
5
+ book = Workbook.new
6
+ ws = book.add_sheet('Image')
7
+ ws.insert_bitmap('examples/python.bmp', 2, 2)
8
+ ws.insert_bitmap('examples/python.bmp', 15, 2)
9
+
10
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,36 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ fnt = Font.new
5
+ fnt.name = 'Arial'
6
+ fnt.colour_index = 4
7
+ fnt.bold = true
8
+
9
+ borders = Borders.new
10
+ borders.left = 6
11
+ borders.right = 6
12
+ borders.top = 6
13
+ borders.bottom = 6
14
+
15
+ al = Alignment.new
16
+ al.horz = Alignment::HORZ_CENTER
17
+ al.vert = Alignment::VERT_CENTER
18
+
19
+ style = StyleFormat.new
20
+ style.font = fnt
21
+ style.borders = borders
22
+ style.alignment = al
23
+
24
+
25
+ book = Workbook.new
26
+ ws0 = book.add_sheet
27
+ ws1 = book.add_sheet
28
+ ws2 = book.add_sheet
29
+
30
+ (0...0x200).step(2) do |i|
31
+ ws0.write_merge(i, i+1, 1, 5, "test #{i}", style)
32
+ ws1.write_merge(i, i, 1, 7, "test #{i}", style)
33
+ ws2.write_merge(i, i+1, 1, 7 + (i%10), "test #{i}", style)
34
+ end
35
+
36
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,27 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws0 = book.add_sheet
6
+
7
+
8
+ fnt = Font.new
9
+ fnt.name = 'Arial'
10
+ fnt.colour_index = 4
11
+ fnt.bold = true
12
+
13
+ borders = Borders.new
14
+ borders.left = 6
15
+ borders.right = 6
16
+ borders.top = 6
17
+ borders.bottom = 6
18
+
19
+ style = StyleFormat.new
20
+ style.font = fnt
21
+ style.borders = borders
22
+
23
+ ws0.write_merge(3, 3, 1, 5, 'test1', style)
24
+ ws0.write_merge(4, 10, 1, 5, 'test2', style)
25
+ ws0.set_column_width(1, 0x0d00)
26
+
27
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,99 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws0 = book.add_sheet
6
+
7
+ fnt1 = Font.new
8
+ fnt1.name = 'Verdana'
9
+ fnt1.bold = true
10
+ fnt1.height = 18*0x14
11
+
12
+ pat1 = Pattern.new
13
+ pat1.pattern = Pattern::SOLID_PATTERN
14
+ pat1.pattern_fore_colour = 0x16
15
+
16
+ brd1 = Borders.new
17
+ brd1.left = 0x06
18
+ brd1.right = 0x06
19
+ brd1.top = 0x06
20
+ brd1.bottom = 0x06
21
+
22
+ fnt2 = Font.new
23
+ fnt2.name = 'Verdana'
24
+ fnt2.bold = true
25
+ fnt2.height = 14*0x14
26
+
27
+ brd2 = Borders.new
28
+ brd2.left = 0x01
29
+ brd2.right = 0x01
30
+ brd2.top = 0x01
31
+ brd2.bottom = 0x01
32
+
33
+ pat2 = Pattern.new
34
+ pat2.pattern = Pattern::SOLID_PATTERN
35
+ pat2.pattern_fore_colour = 0x01F
36
+
37
+ fnt3 = Font.new
38
+ fnt3.name = 'Verdana'
39
+ fnt3.bold = true
40
+ fnt3.italic = true
41
+ fnt3.height = 12*0x14
42
+
43
+ brd3 = Borders.new
44
+ brd3.left = 0x07
45
+ brd3.right = 0x07
46
+ brd3.top = 0x07
47
+ brd3.bottom = 0x07
48
+
49
+ fnt4 = Font.new
50
+
51
+ al1 = Alignment.new
52
+ al1.horz = Alignment::HORZ_CENTER
53
+ al1.vert = Alignment::VERT_CENTER
54
+
55
+ al2 = Alignment.new
56
+ al2.horz = Alignment::HORZ_RIGHT
57
+ al2.vert = Alignment::VERT_CENTER
58
+
59
+ al3 = Alignment.new
60
+ al3.horz = Alignment::HORZ_LEFT
61
+ al3.vert = Alignment::VERT_CENTER
62
+
63
+ style1 = StyleFormat.new
64
+ style1.font = fnt1
65
+ style1.alignment = al1
66
+ style1.pattern = pat1
67
+ style1.borders = brd1
68
+
69
+ style2 = StyleFormat.new
70
+ style2.font = fnt2
71
+ style2.alignment = al1
72
+ style2.pattern = pat2
73
+ style2.borders = brd2
74
+
75
+ style3 = StyleFormat.new
76
+ style3.font = fnt3
77
+ style3.alignment = al1
78
+ style3.pattern = pat2
79
+ style3.borders = brd3
80
+
81
+ price_style = StyleFormat.new
82
+ price_style.font = fnt4
83
+ price_style.alignment = al2
84
+ price_style.borders = brd3
85
+ price_style.number_format_string = '_(#,##0.00_) "money"'
86
+
87
+ ware_style = StyleFormat.new
88
+ ware_style.font = fnt4
89
+ ware_style.alignment = al3
90
+ ware_style.borders = brd3
91
+
92
+
93
+ ws0.merge(3, 3, 1, 5, style1)
94
+ ws0.merge(4, 10, 1, 6, style2)
95
+ ws0.merge(14, 16, 1, 7, style3)
96
+ ws0.set_column_width(1, 0x0d00)
97
+
98
+
99
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,55 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws = book.add_sheet
6
+
7
+ fmts = [
8
+ 'General',
9
+ '0',
10
+ '0.00',
11
+ '#,##0',
12
+ '#,##0.00',
13
+ '"$"#,##0_);("$"#,##',
14
+ '"$"#,##0_);[Red]("$"#,##',
15
+ '"$"#,##0.00_);("$"#,##',
16
+ '"$"#,##0.00_);[Red]("$"#,##',
17
+ '0%',
18
+ '0.00%',
19
+ '0.00E+00',
20
+ '# ?/?',
21
+ '# ??/??',
22
+ 'M/D/YY',
23
+ 'D-MMM-YY',
24
+ 'D-MMM',
25
+ 'MMM-YY',
26
+ 'h:mm AM/PM',
27
+ 'h:mm:ss AM/PM',
28
+ 'h:mm',
29
+ 'h:mm:ss',
30
+ 'M/D/YY h:mm',
31
+ '_(#,##0_);(#,##0)',
32
+ '_(#,##0_);[Red](#,##0)',
33
+ '_(#,##0.00_);(#,##0.00)',
34
+ '_(#,##0.00_);[Red](#,##0.00)',
35
+ '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
36
+ '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
37
+ '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
38
+ '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
39
+ 'mm:ss',
40
+ '[h]:mm:ss',
41
+ 'mm:ss.0',
42
+ '##0.0E+0',
43
+ '@'
44
+ ]
45
+
46
+ fmts.each_with_index do |fmt, i|
47
+ ws.write(i, 0, fmt)
48
+
49
+ style = StyleFormat.new
50
+ style.number_format_string = fmt
51
+
52
+ ws.write(i, 4, -1278.9078, style)
53
+ end
54
+
55
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,24 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ book = Workbook.new
5
+ ws = book.add_sheet
6
+
7
+ ws.write(0, 0, 1)
8
+ ws.write(1, 0, 1.23)
9
+ ws.write(2, 0, 12345678)
10
+ ws.write(3, 0, 123456.78)
11
+
12
+ ws.write(0, 1, -1)
13
+ ws.write(1, 1, -1.23)
14
+ ws.write(2, 1, -12345678)
15
+ ws.write(3, 1, -123456.78)
16
+
17
+ ws.write(0, 2, -17867868678687.0)
18
+ ws.write(1, 2, -1.23e-5)
19
+ ws.write(2, 2, -12345678.90780980)
20
+ ws.write(3, 2, -123456.78)
21
+
22
+ ws.write(0, 4, true)
23
+
24
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file
@@ -0,0 +1,110 @@
1
+ require "rubygems"
2
+ require "surpass"
3
+
4
+ fnt = Font.new
5
+ fnt.name = 'Arial'
6
+ fnt.colour_index = 4
7
+ fnt.bold = true
8
+
9
+ borders = Borders.new
10
+ borders.left = 6
11
+ borders.right = 6
12
+ borders.top = 6
13
+ borders.bottom = 6
14
+
15
+ style = StyleFormat.new
16
+ style.font = fnt
17
+ style.borders = borders
18
+
19
+ book = Workbook.new
20
+
21
+ ws0 = book.add_sheet('Rows Outline')
22
+
23
+ ws0.write_merge(1, 1, 1, 5, 'test 1', style)
24
+ ws0.write_merge(2, 2, 1, 4, 'test 1', style)
25
+ ws0.write_merge(3, 3, 1, 3, 'test 2', style)
26
+ ws0.write_merge(4, 4, 1, 4, 'test 1', style)
27
+ ws0.write_merge(5, 5, 1, 4, 'test 3', style)
28
+ ws0.write_merge(6, 6, 1, 5, 'test 1', style)
29
+ ws0.write_merge(7, 7, 1, 5, 'test 4', style)
30
+ ws0.write_merge(8, 8, 1, 4, 'test 1', style)
31
+ ws0.write_merge(9, 9, 1, 3, 'test 5', style)
32
+
33
+ ws0.row(1).level = 1
34
+ ws0.row(2).level = 1
35
+ ws0.row(3).level = 2
36
+ ws0.row(4).level = 2
37
+ ws0.row(5).level = 2
38
+ ws0.row(6).level = 2
39
+ ws0.row(7).level = 2
40
+ ws0.row(8).level = 1
41
+ ws0.row(9).level = 1
42
+
43
+
44
+ ws1 = book.add_sheet('Columns Outline')
45
+
46
+ ws1.write_merge(1, 1, 1, 5, 'test 1', style)
47
+ ws1.write_merge(2, 2, 1, 4, 'test 1', style)
48
+ ws1.write_merge(3, 3, 1, 3, 'test 2', style)
49
+ ws1.write_merge(4, 4, 1, 4, 'test 1', style)
50
+ ws1.write_merge(5, 5, 1, 4, 'test 3', style)
51
+ ws1.write_merge(6, 6, 1, 5, 'test 1', style)
52
+ ws1.write_merge(7, 7, 1, 5, 'test 4', style)
53
+ ws1.write_merge(8, 8, 1, 4, 'test 1', style)
54
+ ws1.write_merge(9, 9, 1, 3, 'test 5', style)
55
+
56
+ ws1.col(1).level = 1
57
+ ws1.col(2).level = 1
58
+ ws1.col(3).level = 2
59
+ ws1.col(4).level = 2
60
+ ws1.col(5).level = 2
61
+ ws1.col(6).level = 2
62
+ ws1.col(7).level = 2
63
+ ws1.col(8).level = 1
64
+ ws1.col(9).level = 1
65
+
66
+
67
+ ws2 = book.add_sheet('Rows and Columns Outline')
68
+
69
+ ws2.write_merge(1, 1, 1, 5, 'test 1', style)
70
+ ws2.write_merge(2, 2, 1, 4, 'test 1', style)
71
+ ws2.write_merge(3, 3, 1, 3, 'test 2', style)
72
+ ws2.write_merge(4, 4, 1, 4, 'test 1', style)
73
+ ws2.write_merge(5, 5, 1, 4, 'test 3', style)
74
+ ws2.write_merge(6, 6, 1, 5, 'test 1', style)
75
+ ws2.write_merge(7, 7, 1, 5, 'test 4', style)
76
+ ws2.write_merge(8, 8, 1, 4, 'test 1', style)
77
+ ws2.write_merge(9, 9, 1, 3, 'test 5', style)
78
+
79
+ ws2.row(1).level = 1
80
+ ws2.row(2).level = 1
81
+ ws2.row(3).level = 2
82
+ ws2.row(4).level = 2
83
+ ws2.row(5).level = 2
84
+ ws2.row(6).level = 2
85
+ ws2.row(7).level = 2
86
+ ws2.row(8).level = 1
87
+ ws2.row(9).level = 1
88
+
89
+ ws2.write_merge(1, 1, 1, 5, 'test 1', style)
90
+ ws2.write_merge(2, 2, 1, 4, 'test 1', style)
91
+ ws2.write_merge(3, 3, 1, 3, 'test 2', style)
92
+ ws2.write_merge(4, 4, 1, 4, 'test 1', style)
93
+ ws2.write_merge(5, 5, 1, 4, 'test 3', style)
94
+ ws2.write_merge(6, 6, 1, 5, 'test 1', style)
95
+ ws2.write_merge(7, 7, 1, 5, 'test 4', style)
96
+ ws2.write_merge(8, 8, 1, 4, 'test 1', style)
97
+ ws2.write_merge(9, 9, 1, 3, 'test 5', style)
98
+
99
+ ws2.col(1).level = 1
100
+ ws2.col(2).level = 1
101
+ ws2.col(3).level = 2
102
+ ws2.col(4).level = 2
103
+ ws2.col(5).level = 2
104
+ ws2.col(6).level = 2
105
+ ws2.col(7).level = 2
106
+ ws2.col(8).level = 1
107
+ ws2.col(9).level = 1
108
+
109
+
110
+ book.save(__FILE__.gsub(/rb$/, "xls"))
Binary file