Permalink
Browse files

Rebuild documentation.

  • Loading branch information...
1 parent 9b24301 commit 32c3fd5fd54789b3de3c2ba3f769a6cbbc09b8d6 Ana Nelson committed Jun 13, 2010
Showing with 600 additions and 412 deletions.
  1. +9 −0 Rakefile
  2. +5 −4 examples/big-16mb.rb
  3. +7 −6 examples/big-random-strings.rb
  4. +11 −11 examples/blanks.rb
  5. +7 −6 examples/col_width.rb
  6. +6 −5 examples/dates.rb
  7. +10 −9 examples/format.rb
  8. +44 −42 examples/formulas.rb
  9. +3 −4 examples/hello-world.rb
  10. +7 −5 examples/image.rb
  11. +12 −12 examples/merged.rb
  12. +7 −7 examples/merged0.rb
  13. +9 −7 examples/merged1.rb
  14. +6 −5 examples/num_formats.rb
  15. +18 −16 examples/numbers.rb
  16. +27 −23 examples/outline.rb
  17. +34 −34 examples/panes.rb
  18. +31 −31 examples/protection.rb
  19. +8 −6 examples/row_height.rb
  20. +6 −5 examples/row_styles.rb
  21. +5 −4 examples/row_styles_empty.rb
  22. +8 −7 examples/set_cell_and_range_style.rb
  23. +8 −6 examples/wrapped-text.rb
  24. +11 −9 examples/write_arrays.rb
  25. +14 −7 examples/ws_props.rb
  26. +1 −1 lib/surpass.rb
  27. +3 −0 lib/surpass/row.rb
  28. +80 −5 webby/Sitefile
  29. BIN webby/content/examples/autoformat.png
  30. +16 −12 webby/content/examples/autoformat.rb
  31. BIN webby/content/examples/autoformat.xls
  32. BIN webby/content/examples/borders.png
  33. +3 −1 webby/content/examples/borders.rb
  34. BIN webby/content/examples/borders.xls
  35. BIN webby/content/examples/colours.png
  36. +3 −1 webby/content/examples/colours.rb
  37. BIN webby/content/examples/colours.xls
  38. BIN webby/content/examples/data.png
  39. BIN webby/content/examples/data.xls
  40. BIN webby/content/examples/formatting.png
  41. +7 −5 webby/content/examples/formatting.rb
  42. BIN webby/content/examples/formatting.xls
  43. BIN webby/content/examples/formulas.png
  44. +52 −0 webby/content/examples/formulas.rb
  45. BIN webby/content/examples/formulas.xls
  46. BIN webby/content/examples/hello-world.png
  47. BIN webby/content/examples/hello-world.xls
  48. BIN webby/content/examples/number-format-string.png
  49. +4 −2 webby/content/examples/number-format-string.rb
  50. BIN webby/content/examples/number-format-string.xls
  51. BIN webby/content/examples/patterns.png
  52. +3 −1 webby/content/examples/patterns.rb
  53. BIN webby/content/examples/patterns.xls
  54. +1 −1 webby/content/index.txt
  55. +3 −2 webby/content/source/ExcelFormulaLexer.txt
  56. +3 −2 webby/content/source/ExcelFormulaParser.txt
  57. +3 −2 webby/content/source/biff_record.txt
  58. +3 −2 webby/content/source/bitmap.txt
  59. +3 −2 webby/content/source/cell.txt
  60. +3 −2 webby/content/source/chart.txt
  61. +3 −2 webby/content/source/column.txt
  62. +3 −2 webby/content/source/document.txt
  63. +0 −7 webby/content/source/excel_formula.txt
  64. +3 −2 webby/content/source/excel_magic.txt
  65. +3 −2 webby/content/source/formatting.txt
  66. +8 −0 webby/content/source/formula.txt
  67. +3 −2 webby/content/source/row.txt
  68. +3 −2 webby/content/source/style.txt
  69. +3 −2 webby/content/source/utilities.txt
  70. +3 −2 webby/content/source/workbook.txt
  71. +3 −2 webby/content/source/worksheet.txt
  72. +6 −1 webby/content/surpass-manual.erb
  73. +53 −0 webby/layouts/no-sidebar.txt
  74. +2 −2 webby/layouts/web.txt
  75. +0 −14 webby/tasks/latex.rake
  76. +0 −58 webby/tasks/screenshots.rb
View
@@ -26,3 +26,12 @@ desc "run antlr compiler"
task :antlr do
`cd lib/surpass; antlr4ruby ExcelFormula.g`
end
+
+desc "run examples"
+task :examples do
+ `rm examples/*.xls`
+ `cd examples; ls *.rb`.chomp.split.each do |f|
+ next if f =~ /big/
+ `jruby #{File.expand_path(f, "examples")}`
+ end
+end
@@ -1,8 +1,9 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
book = Workbook.new
-s = book.add_sheet('0')
+sheet = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
colcount = 200 + 1
rowcount = 6000 + 1
@@ -12,7 +13,7 @@
colcount.times do |c|
rowcount.times do |r|
- s.write(r, c, "BIG")
+ sheet.write(r+1, c, "BIG")
end
end
@@ -1,10 +1,11 @@
-require "rubygems"
-require "surpass"
-
-strings = File.read("spec/data/random-strings.txt").split("\n")
+require "lib/surpass"
book = Workbook.new
-s = book.add_sheet('0')
+sheet = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
+
+strings = File.read("spec/data/random-strings.txt").split("\n")
colcount = 100 + 1
rowcount = 100 + 1
@@ -15,7 +16,7 @@
colcount.times do |c|
rowcount.times do |r|
i = c * rowcount + r
- s.write(r, c, strings[i])
+ sheet.write(r+1, c, strings[i])
end
end
View
@@ -1,5 +1,9 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
+
+book = Workbook.new
+sheet = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
font0 = Font.new
font0.name = 'Times New Roman'
@@ -9,11 +13,7 @@
style0 = StyleFormat.new
style0.font = font0
-
-book = Workbook.new
-ws0 = book.add_sheet('0')
-
-ws0.write(1, 1, 'Test', style0)
+sheet.write(1, 1, 'Test', style0)
0.upto(13) do |i|
borders = Borders.new
@@ -25,10 +25,10 @@
style = StyleFormat.new
style.borders = borders
- ws0.write(i, 2, '', style)
- ws0.write(i, 3, hex(i), style0)
+ sheet.write(i+1, 2, '', style)
+ sheet.write(i+1, 3, hex(i), style0)
end
-ws0.write_merge(5, 8, 6, 10, "")
+sheet.write_merge(5, 8, 6, 10, "")
-book.save(__FILE__.gsub(/rb$/, "xls"))
+book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,16 +1,17 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
book = Workbook.new
-ws = book.add_sheet('Hey, Dude')
+sheet = book.add_sheet("col widths")
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
(6...80).each do |i|
fnt = Font.new
fnt.height = i*20
style = StyleFormat.new
style.font = fnt
- ws.write(1, i, 'Test')
- ws.set_column_width(i, i)
+ sheet.write(1, i, 'Test')
+ sheet.set_column_width(i, i)
end
-book.save(__FILE__.gsub(/rb$/, "xls"))
+book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,8 +1,9 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
book = Workbook.new
-ws = book.add_sheet('Hey, Dude')
+sheet = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
formats = [
'M/D/YY',
@@ -20,12 +21,12 @@
]
formats.each_with_index do |f, i|
- ws.write(i, 0, f)
+ sheet.write(i, 0, f)
style = StyleFormat.new
style.number_format_string = f
- ws.write(i, 4, Time.now, style)
+ sheet.write(i, 4, Time.now, style)
end
book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,12 +1,13 @@
-require "rubygems"
-require "surpass"
-
-style0 = StyleFormat.new(:font_name => 'Times New Roman', :font_struck_out => true, :font_bold => true)
+require "lib/surpass"
book = Workbook.new
-ws0 = book.add_sheet('0')
+sheet = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
+
+style0 = StyleFormat.new(:font_name => 'Times New Roman', :font_struck_out => true, :font_bold => true)
-ws0.write(1, 1, 'Test', style0)
+sheet.write(1, 1, 'Test', style0)
(0...14).each do |i|
style = StyleFormat.new(:font_name => 'Arial', :font_color_index => i, :font_outline => true)
@@ -16,8 +17,8 @@
style.borders = borders
- ws0.write(i, 2, 'colour', style)
- ws0.write(i, 3, hex(i), style0)
+ sheet.write(i, 2, 'colour', style)
+ sheet.write(i, 3, hex(i), style0)
end
-book.save(__FILE__.gsub(/rb$/, "xls"))
+book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,64 +1,66 @@
require "lib/surpass"
book = Workbook.new
-ws = book.add_sheet
+sheet = book.add_sheet
-ws.write(0, 0, Formula.new("-(1+1)"))
-ws.write(1, 0, Formula.new("-(1+1)/(-2-2)"))
-ws.write(2, 0, Formula.new("-(134.8780789+1)"))
-ws.write(3, 0, Formula.new("-(134.8780789e-10+1)"))
-ws.write(4, 0, Formula.new("-1/(1+1)+9344"))
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
-ws.write(0, 1, Formula.new("-(1+1)"))
-ws.write(1, 1, Formula.new("-(1+1)/(-2-2)"))
-ws.write(2, 1, Formula.new("-(134.8780789+1)"))
-ws.write(3, 1, Formula.new("-(134.8780789e-10+1)"))
-ws.write(4, 1, Formula.new("-1/(1+1)+9344"))
+sheet.write(2, 0, Formula.new("-(134.8780789+1)"))
+sheet.write(3, 0, Formula.new("-(134.8780789e-10+1)"))
+sheet.write(4, 0, Formula.new("-1/(1+1)+9344"))
+sheet.write(5, 0, Formula.new("-(1+1)"))
+sheet.write(6, 0, Formula.new("-(1+1)/(-2-2)"))
-ws.write(0, 2, Formula.new("A1*B1"))
-ws.write(1, 2, Formula.new("A2*B2"))
-ws.write(2, 2, Formula.new("A3*B3"))
+sheet.write(2, 1, Formula.new("-(134.8780789+1)"))
+sheet.write(3, 1, Formula.new("-(134.8780789e-10+1)"))
+sheet.write(4, 1, Formula.new("-1/(1+1)+9344"))
+sheet.write(5, 1, Formula.new("-(1+1)"))
+sheet.write(6, 1, Formula.new("-(1+1)/(-2-2)"))
-ws.write(0, 3, Formula.new("5%"))
+sheet.write(2, 2, Formula.new("A3*B3"))
+sheet.write(3, 2, Formula.new("A3*B4"))
+sheet.write(4, 2, Formula.new("A6*B6"))
-ws.write(3, 2, Formula.new("A4*B4*sin(pi()/4)"))
-ws.write(4, 2, Formula.new("A5%*B5*pi()/1000"))
+sheet.write(3, 3, Formula.new("5%"))
-ws.write(9, 9, Formula.new("A3>=B3"))
+sheet.write(3, 5, Formula.new("A4*B4*sin(pi()/4)"))
+sheet.write(4, 5, Formula.new("A5%*B5*pi()/1000"))
-ws.write(5, 2, Formula.new("C1+C2+C3+C4+C5/(C1+C2+C3+C4/(C1+C2+C3+C4/(C1+C2+C3+C4)+C5)+C5)-20.3e-2"))
-ws.write(5, 3, Formula.new("C1^2"))
-ws.write(6, 2, Formula.new("SUM(C1;C2;;;;;C3;;;C4)"))
-ws.write(6, 3, Formula.new("SUM($A$1:$C$5)"))
+sheet.write(9, 9, Formula.new("A3>=B3"))
-ws.write(7, 0, Formula.new('"lkjljllkllkl"'))
-ws.write(7, 1, Formula.new('"yuyiyiyiyi"'))
-ws.write(7, 2, Formula.new('A8&B8&A8'))
-ws.write(7, 3, Formula.new('A8 & B8 & A8'))
+sheet.write(5, 2, Formula.new("C1+C2+C3+C4+C5/(C1+C2+C3+C4/(C1+C2+C3+C4/(C1+C2+C3+C4)+C5)+C5)-20.3e-2"))
+sheet.write(5, 3, Formula.new("C1^2"))
+sheet.write(6, 2, Formula.new("SUM(C1;C2;;;;;C3;;;C4)"))
+sheet.write(6, 3, Formula.new("SUM($A$1:$C$5)"))
-ws.write(10, 2, Formula.new('TRUE'))
-ws.write(11, 2, Formula.new('FALSE'))
-ws.write(12, 4, Formula.new('IF(A1>A2;3;"hkjhjkhk")')) # Semicolon param delim.
-ws.write(12, 5, Formula.new('IF(A1<A2 , 3 , "hkjhjkhk")')) # Try using commas + adding whitespace.
-ws.write(12, 7, Formula.new('CHOOSE(1, "a", "b")'))
-ws.write(12, 8, Formula.new('CHOOSE(2, "a", "b")'))
-ws.write(12, 9, Formula.new("CHOOSE(15, \"#{('a'..'z').to_a.join("\", \"")}\")"))
+sheet.write(7, 0, Formula.new('"lkjljllkllkl"'))
+sheet.write(7, 1, Formula.new('"yuyiyiyiyi"'))
+sheet.write(7, 2, Formula.new('A8&B8&A8'))
+sheet.write(7, 3, Formula.new('A8 & B8 & A8'))
+
+sheet.write(10, 2, Formula.new('TRUE'))
+sheet.write(11, 2, Formula.new('FALSE'))
+sheet.write(12, 4, Formula.new('IF(A1>A2;3;"hkjhjkhk")')) # Semicolon param delim.
+sheet.write(12, 5, Formula.new('IF(A1<A2 , 3 , "hkjhjkhk")')) # Try using commas + adding whitespace.
+sheet.write(12, 7, Formula.new('CHOOSE(1, "a", "b")'))
+sheet.write(12, 8, Formula.new('CHOOSE(2, "a", "b")'))
+sheet.write(12, 9, Formula.new("CHOOSE(15, \"#{('a'..'z').to_a.join("\", \"")}\")"))
# Formulas
-ws.write(14, 0, Formula.new("pi()"))
-ws.write(14, 1, Formula.new("2*pi()"))
-ws.write(14, 2, Formula.new("sin(0)"))
-ws.write(14, 3, Formula.new('left("abcde", 2)'))
-ws.write(14, 4, Formula.new('hyperlink("http://google.com", "google")'))
-ws.write(14, 5, Formula.new("sin(pi())"))
-ws.write(14, 6, Formula.new('now()'))
+sheet.write(14, 0, Formula.new("pi()"))
+sheet.write(14, 1, Formula.new("2*pi()"))
+sheet.write(14, 2, Formula.new("sin(0)"))
+sheet.write(14, 3, Formula.new('left("abcde", 2)'))
+sheet.write(14, 4, Formula.new('hyperlink("http://google.com", "google")'))
+sheet.write(14, 5, Formula.new("sin(pi())"))
+sheet.write(14, 6, Formula.new('now()'))
# TODO implement sheet references
# sheet2 = book.add_sheet("s")
# sheet2.write(0, 0, 100)
-# ws.write(16, 0, Formula.new("s!A1"))
+# sheet.write(16, 0, Formula.new("s!A1"))
# TODO have way to define custom functions e.g. Surpass.declare_excel_function('blp', 3, 5, "V", "V R R")
-# ws.write(15, 0, Formula.new("blp()"))
+# sheet.write(15, 0, Formula.new("blp()"))
book.save(__FILE__.gsub(/rb$/, "xls"))
@@ -1,9 +1,8 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
book = Workbook.new
-ws = book.add_sheet
+sheet = book.add_sheet
-ws.write(0, 0, "Hello World")
+sheet.write(0, 0, "Hello World")
book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,11 +1,13 @@
-require "rubygems"
-require "surpass"
-
-# TODO As this example shows, there is a bug in the size calculation somewhere.
+require "lib/surpass"
book = Workbook.new
-sheet = book.add_sheet('Image')
+sheet = book.add_sheet("Image")
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
+
+# TODO As this example shows, there is a bug in the size calculation somewhere.
sheet.set_column_width(2, 20)
sheet.insert_bitmap('examples/python.bmp', 2, 2)
sheet.insert_bitmap('examples/python.bmp', 15, 0)
+
book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,5 +1,11 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
+
+book = Workbook.new
+sheet0 = book.add_sheet
+sheet1 = book.add_sheet
+sheet2 = book.add_sheet
+
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
fnt = Font.new
fnt.name = 'Arial'
@@ -21,16 +27,10 @@
style.borders = borders
style.alignment = al
-
-book = Workbook.new
-ws0 = book.add_sheet
-ws1 = book.add_sheet
-ws2 = book.add_sheet
-
(0...0x200).step(2) do |i|
- ws0.write_merge(i, i+1, 1, 5, "test #{i}", style)
- ws1.write_merge(i, i, 1, 7, "test #{i}", style)
- ws2.write_merge(i, i+1, 1, 7 + (i%10), "test #{i}", style)
+ sheet0.write_merge(i+1, i+1, 1, 5, "test #{i}", style)
+ sheet1.write_merge(i+1, i, 1, 7, "test #{i}", style)
+ sheet2.write_merge(i+1, i+1, 1, 7 + (i%10), "test #{i}", style)
end
-book.save(__FILE__.gsub(/rb$/, "xls"))
+book.save(__FILE__.gsub(/rb$/, "xls"))
View
@@ -1,9 +1,9 @@
-require "rubygems"
-require "surpass"
+require "lib/surpass"
book = Workbook.new
-ws0 = book.add_sheet
+sheet = book.add_sheet
+sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")
fnt = Font.new
fnt.name = 'Arial'
@@ -20,8 +20,8 @@
style.font = fnt
style.borders = borders
-ws0.write_merge(3, 3, 1, 5, 'test1', style)
-ws0.write_merge(4, 10, 1, 5, 'test2', style)
-ws0.set_column_width(1, 0x0d00)
+sheet.write_merge(3, 3, 1, 5, 'test1', style)
+sheet.write_merge(4, 10, 1, 5, 'test2', style)
+sheet.set_column_width(1, 0x0d00)
-book.save(__FILE__.gsub(/rb$/, "xls"))
+book.save(__FILE__.gsub(/rb$/, "xls"))
Oops, something went wrong.

0 comments on commit 32c3fd5

Please sign in to comment.