writeexcel 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/README +26 -31
  2. data/examples/a_simple.rb +42 -42
  3. data/examples/{autofilters.rb → autofilter.rb} +264 -266
  4. data/examples/bigfile.rb +29 -0
  5. data/examples/chart_area.rb +120 -0
  6. data/examples/chart_bar.rb +119 -0
  7. data/examples/chart_column.rb +119 -0
  8. data/examples/chart_line.rb +119 -0
  9. data/examples/chart_pie.rb +107 -0
  10. data/examples/chart_scatter.rb +120 -0
  11. data/examples/chart_stock.rb +147 -0
  12. data/examples/copyformat.rb +51 -51
  13. data/examples/data_validate.rb +278 -278
  14. data/examples/date_time.rb +86 -86
  15. data/examples/defined_name.rb +31 -0
  16. data/examples/demo.rb +120 -118
  17. data/examples/diag_border.rb +35 -35
  18. data/examples/formats.rb +489 -489
  19. data/examples/header.rb +136 -136
  20. data/examples/hidden.rb +28 -28
  21. data/examples/hyperlink.rb +42 -42
  22. data/examples/images.rb +52 -52
  23. data/examples/merge1.rb +39 -39
  24. data/examples/merge2.rb +44 -44
  25. data/examples/merge3.rb +65 -65
  26. data/examples/merge4.rb +82 -82
  27. data/examples/merge5.rb +79 -79
  28. data/examples/properties.rb +33 -0
  29. data/examples/properties_jp.rb +32 -0
  30. data/examples/protection.rb +46 -46
  31. data/examples/regions.rb +52 -52
  32. data/examples/repeat.rb +42 -42
  33. data/examples/stats.rb +75 -75
  34. data/examples/stocks.rb +80 -80
  35. data/examples/tab_colors.rb +30 -30
  36. data/examples/write_arrays.rb +82 -0
  37. data/lib/writeexcel.rb +1134 -18
  38. data/lib/writeexcel/biffwriter.rb +273 -260
  39. data/lib/writeexcel/chart.rb +2306 -217
  40. data/lib/writeexcel/charts/area.rb +152 -0
  41. data/lib/writeexcel/charts/bar.rb +177 -0
  42. data/lib/writeexcel/charts/column.rb +156 -0
  43. data/lib/writeexcel/charts/external.rb +61 -0
  44. data/lib/writeexcel/charts/line.rb +152 -0
  45. data/lib/writeexcel/charts/pie.rb +169 -0
  46. data/lib/writeexcel/charts/scatter.rb +192 -0
  47. data/lib/writeexcel/charts/stock.rb +211 -0
  48. data/lib/writeexcel/excelformulaparser.rb +208 -195
  49. data/lib/writeexcel/format.rb +1697 -1108
  50. data/lib/writeexcel/formula.rb +1050 -986
  51. data/lib/writeexcel/olewriter.rb +322 -322
  52. data/lib/writeexcel/properties.rb +251 -250
  53. data/lib/writeexcel/storage_lite.rb +968 -0
  54. data/lib/writeexcel/workbook.rb +3294 -2630
  55. data/lib/writeexcel/worksheet.rb +9012 -6377
  56. data/test/excelfile/Chart1.xls +0 -0
  57. data/test/excelfile/Chart2.xls +0 -0
  58. data/test/excelfile/Chart3.xls +0 -0
  59. data/test/excelfile/Chart4.xls +0 -0
  60. data/test/excelfile/Chart5.xls +0 -0
  61. data/test/perl_output/Chart1.xls.data +0 -0
  62. data/test/perl_output/Chart2.xls.data +0 -0
  63. data/test/perl_output/Chart3.xls.data +0 -0
  64. data/test/perl_output/Chart4.xls.data +0 -0
  65. data/test/perl_output/Chart5.xls.data +0 -0
  66. data/test/perl_output/a_simple.xls +0 -0
  67. data/test/perl_output/autofilter.xls +0 -0
  68. data/test/perl_output/chart_area.xls +0 -0
  69. data/test/perl_output/chart_bar.xls +0 -0
  70. data/test/perl_output/chart_column.xls +0 -0
  71. data/test/perl_output/chart_line.xls +0 -0
  72. data/test/perl_output/data_validate.xls +0 -0
  73. data/test/perl_output/date_time.xls +0 -0
  74. data/test/perl_output/demo.xls +0 -0
  75. data/test/perl_output/demo101.bin +0 -0
  76. data/test/perl_output/demo201.bin +0 -0
  77. data/test/perl_output/demo301.bin +0 -0
  78. data/test/perl_output/demo401.bin +0 -0
  79. data/test/perl_output/demo501.bin +0 -0
  80. data/test/perl_output/diag_border.xls +0 -0
  81. data/test/perl_output/headers.xls +0 -0
  82. data/test/perl_output/hyperlink.xls +0 -0
  83. data/test/perl_output/images.xls +0 -0
  84. data/test/perl_output/merge1.xls +0 -0
  85. data/test/perl_output/merge2.xls +0 -0
  86. data/test/perl_output/merge3.xls +0 -0
  87. data/test/perl_output/merge4.xls +0 -0
  88. data/test/perl_output/merge5.xls +0 -0
  89. data/test/perl_output/protection.xls +0 -0
  90. data/test/perl_output/regions.xls +0 -0
  91. data/test/perl_output/stats.xls +0 -0
  92. data/test/perl_output/stocks.xls +0 -0
  93. data/test/perl_output/tab_colors.xls +0 -0
  94. data/test/perl_output/unicode_cyrillic.xls +0 -0
  95. data/test/perl_output/workbook1.xls +0 -0
  96. data/test/perl_output/workbook2.xls +0 -0
  97. data/test/tc_all.rb +32 -31
  98. data/test/tc_biff.rb +104 -104
  99. data/test/tc_chart.rb +22 -22
  100. data/test/tc_example_match.rb +1944 -1280
  101. data/test/tc_format.rb +1254 -1267
  102. data/test/tc_formula.rb +63 -63
  103. data/test/tc_ole.rb +110 -110
  104. data/test/tc_storage_lite.rb +149 -0
  105. data/test/tc_workbook.rb +140 -115
  106. data/test/tc_worksheet.rb +115 -115
  107. data/test/test_00_IEEE_double.rb +14 -14
  108. data/test/test_01_add_worksheet.rb +12 -12
  109. data/test/test_02_merge_formats.rb +58 -58
  110. data/test/test_04_dimensions.rb +397 -397
  111. data/test/test_05_rows.rb +182 -182
  112. data/test/test_06_extsst.rb +80 -80
  113. data/test/test_11_date_time.rb +484 -484
  114. data/test/test_12_date_only.rb +506 -506
  115. data/test/test_13_date_seconds.rb +486 -486
  116. data/test/test_21_escher.rb +642 -629
  117. data/test/test_22_mso_drawing_group.rb +750 -739
  118. data/test/test_23_note.rb +78 -78
  119. data/test/test_24_txo.rb +80 -80
  120. data/test/test_25_position_object.rb +82 -0
  121. data/test/test_26_autofilter.rb +327 -327
  122. data/test/test_27_autofilter.rb +144 -144
  123. data/test/test_28_autofilter.rb +174 -174
  124. data/test/test_29_process_jpg.rb +681 -131
  125. data/test/test_30_validation_dval.rb +82 -82
  126. data/test/test_31_validation_dv_strings.rb +131 -131
  127. data/test/test_32_validation_dv_formula.rb +211 -211
  128. data/test/test_40_property_types.rb +191 -191
  129. data/test/test_41_properties.rb +238 -238
  130. data/test/test_42_set_properties.rb +442 -419
  131. data/test/test_50_name_stored.rb +305 -0
  132. data/test/test_51_name_print_area.rb +363 -0
  133. data/test/test_52_name_print_titles.rb +460 -0
  134. data/test/test_53_autofilter.rb +209 -0
  135. data/test/test_60_chart_generic.rb +576 -0
  136. data/test/test_61_chart_subclasses.rb +97 -0
  137. data/test/test_62_chart_formats.rb +270 -0
  138. data/test/test_63_chart_area_formats.rb +647 -0
  139. data/test/test_chartex.rb +35 -0
  140. data/test/ts_all.rb +46 -34
  141. data/writeexcel.gemspec +18 -0
  142. data/writeexcel.rdoc +583 -0
  143. metadata +162 -108
data/examples/stats.rb CHANGED
@@ -1,75 +1,75 @@
1
- #!/usr/bin/ruby -w
2
-
3
- ###############################################################################
4
- #
5
- # This is a simple example of how to use functions with the
6
- # Spreadsheet::WriteExcel module.
7
- #
8
- # reverse('©'), March 2001, John McNamara, jmcnamara@cpan.org
9
- #
10
- # original written in Perl by John McNamara
11
- # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
- #
13
-
14
- require 'rubygems'
15
- require 'writeexcel'
16
- include Spreadsheet
17
- xlsfile = 'stats.xls'
18
-
19
- workbook = Spreadsheet::WriteExcel.new(xlsfile)
20
- worksheet = workbook.add_worksheet('Test data')
21
-
22
- # Set the column width for columns 1
23
- worksheet.set_column(0, 0, 20)
24
-
25
-
26
- # Create a format for the headings
27
- format = workbook.add_format
28
- format.set_bold
29
-
30
-
31
- # Write the sample data
32
- worksheet.write(0, 0, 'Sample', format)
33
- worksheet.write(0, 1, 1)
34
- worksheet.write(0, 2, 2)
35
- worksheet.write(0, 3, 3)
36
- worksheet.write(0, 4, 4)
37
- worksheet.write(0, 5, 5)
38
- worksheet.write(0, 6, 6)
39
- worksheet.write(0, 7, 7)
40
- worksheet.write(0, 8, 8)
41
-
42
- worksheet.write(1, 0, 'Length', format)
43
- worksheet.write(1, 1, 25.4)
44
- worksheet.write(1, 2, 25.4)
45
- worksheet.write(1, 3, 24.8)
46
- worksheet.write(1, 4, 25.0)
47
- worksheet.write(1, 5, 25.3)
48
- worksheet.write(1, 6, 24.9)
49
- worksheet.write(1, 7, 25.2)
50
- worksheet.write(1, 8, 24.8)
51
-
52
- # Write some statistical functions
53
- worksheet.write(4, 0, 'Count', format)
54
- worksheet.write(4, 1, '=COUNT(B1:I1)')
55
-
56
- worksheet.write(5, 0, 'Sum', format)
57
- worksheet.write(5, 1, '=SUM(B2:I2)')
58
-
59
- worksheet.write(6, 0, 'Average', format)
60
- worksheet.write(6, 1, '=AVERAGE(B2:I2)')
61
-
62
- worksheet.write(7, 0, 'Min', format)
63
- worksheet.write(7, 1, '=MIN(B2:I2)')
64
-
65
- worksheet.write(8, 0, 'Max', format)
66
- worksheet.write(8, 1, '=MAX(B2:I2)')
67
-
68
- worksheet.write(9, 0, 'Standard Deviation', format)
69
- worksheet.write(9, 1, '=STDEV(B2:I2)')
70
-
71
- worksheet.write(10, 0, 'Kurtosis', format)
72
- worksheet.write(10, 1, '=KURT(B2:I2)')
73
-
74
- workbook.close
75
-
1
+ #!/usr/bin/ruby -w
2
+
3
+ ###############################################################################
4
+ #
5
+ # This is a simple example of how to use functions with the
6
+ # WriteExcel module.
7
+ #
8
+ # reverse('©'), March 2001, John McNamara, jmcnamara@cpan.org
9
+ #
10
+ # original written in Perl by John McNamara
11
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
12
+ #
13
+
14
+ require 'rubygems'
15
+ require 'writeexcel'
16
+ include Spreadsheet
17
+ xlsfile = 'stats.xls'
18
+
19
+ workbook = WriteExcel.new(xlsfile)
20
+ worksheet = workbook.add_worksheet('Test data')
21
+
22
+ # Set the column width for columns 1
23
+ worksheet.set_column(0, 0, 20)
24
+
25
+
26
+ # Create a format for the headings
27
+ format = workbook.add_format
28
+ format.set_bold
29
+
30
+
31
+ # Write the sample data
32
+ worksheet.write(0, 0, 'Sample', format)
33
+ worksheet.write(0, 1, 1)
34
+ worksheet.write(0, 2, 2)
35
+ worksheet.write(0, 3, 3)
36
+ worksheet.write(0, 4, 4)
37
+ worksheet.write(0, 5, 5)
38
+ worksheet.write(0, 6, 6)
39
+ worksheet.write(0, 7, 7)
40
+ worksheet.write(0, 8, 8)
41
+
42
+ worksheet.write(1, 0, 'Length', format)
43
+ worksheet.write(1, 1, 25.4)
44
+ worksheet.write(1, 2, 25.4)
45
+ worksheet.write(1, 3, 24.8)
46
+ worksheet.write(1, 4, 25.0)
47
+ worksheet.write(1, 5, 25.3)
48
+ worksheet.write(1, 6, 24.9)
49
+ worksheet.write(1, 7, 25.2)
50
+ worksheet.write(1, 8, 24.8)
51
+
52
+ # Write some statistical functions
53
+ worksheet.write(4, 0, 'Count', format)
54
+ worksheet.write(4, 1, '=COUNT(B1:I1)')
55
+
56
+ worksheet.write(5, 0, 'Sum', format)
57
+ worksheet.write(5, 1, '=SUM(B2:I2)')
58
+
59
+ worksheet.write(6, 0, 'Average', format)
60
+ worksheet.write(6, 1, '=AVERAGE(B2:I2)')
61
+
62
+ worksheet.write(7, 0, 'Min', format)
63
+ worksheet.write(7, 1, '=MIN(B2:I2)')
64
+
65
+ worksheet.write(8, 0, 'Max', format)
66
+ worksheet.write(8, 1, '=MAX(B2:I2)')
67
+
68
+ worksheet.write(9, 0, 'Standard Deviation', format)
69
+ worksheet.write(9, 1, '=STDEV(B2:I2)')
70
+
71
+ worksheet.write(10, 0, 'Kurtosis', format)
72
+ worksheet.write(10, 1, '=KURT(B2:I2)')
73
+
74
+ workbook.close
75
+
data/examples/stocks.rb CHANGED
@@ -1,80 +1,80 @@
1
- #!/usr/bin/ruby -w
2
-
3
- ###############################################################################
4
- #
5
- # Example of formatting using the Spreadsheet::WriteExcel module
6
- #
7
- # This example shows how to use a conditional numerical format
8
- # with colours to indicate if a share price has gone up or down.
9
- #
10
- # reverse('©'), March 2001, John McNamara, jmcnamara@cpan.org
11
- #
12
- # original written in Perl by John McNamara
13
- # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
- #
15
-
16
- require 'rubygems'
17
- require 'writeexcel'
18
-
19
- # Create a new workbook and add a worksheet
20
- workbook = Spreadsheet::WriteExcel.new("stocks.xls")
21
- worksheet = workbook.add_worksheet
22
-
23
- # Set the column width for columns 1, 2, 3 and 4
24
- worksheet.set_column(0, 3, 15)
25
-
26
-
27
- # Create a format for the column headings
28
- header = workbook.add_format
29
- header.set_bold
30
- header.set_size(12)
31
- header.set_color('blue')
32
-
33
-
34
- # Create a format for the stock price
35
- f_price = workbook.add_format
36
- f_price.set_align('left')
37
- f_price.set_num_format('$0.00')
38
-
39
-
40
- # Create a format for the stock volume
41
- f_volume = workbook.add_format
42
- f_volume.set_align('left')
43
- f_volume.set_num_format('#,##0')
44
-
45
-
46
- # Create a format for the price change. This is an example of a conditional
47
- # format. The number is formatted as a percentage. If it is positive it is
48
- # formatted in green, if it is negative it is formatted in red and if it is
49
- # zero it is formatted as the default font colour (in this case black).
50
- # Note: the [Green] format produces an unappealing lime green. Try
51
- # [Color 10] instead for a dark green.
52
- #
53
- f_change = workbook.add_format
54
- f_change.set_align('left')
55
- f_change.set_num_format('[Green]0.0%;[Red]-0.0%;0.0%')
56
-
57
-
58
- # Write out the data
59
- worksheet.write(0, 0, 'Company', header)
60
- worksheet.write(0, 1, 'Price', header)
61
- worksheet.write(0, 2, 'Volume', header)
62
- worksheet.write(0, 3, 'Change', header)
63
-
64
- worksheet.write(1, 0, 'Damage Inc.' )
65
- worksheet.write(1, 1, 30.25, f_price) # $30.25
66
- worksheet.write(1, 2, 1234567, f_volume) # 1,234,567
67
- worksheet.write(1, 3, 0.085, f_change) # 8.5% in green
68
-
69
- worksheet.write(2, 0, 'Dump Corp.' )
70
- worksheet.write(2, 1, 1.56, f_price) # $1.56
71
- worksheet.write(2, 2, 7564, f_volume) # 7,564
72
- worksheet.write(2, 3, -0.015, f_change) # -1.5% in red
73
-
74
- worksheet.write(3, 0, 'Rev Ltd.' )
75
- worksheet.write(3, 1, 0.13, f_price) # $0.13
76
- worksheet.write(3, 2, 321, f_volume) # 321
77
- worksheet.write(3, 3, 0, f_change) # 0 in the font color (black)
78
-
79
-
80
- workbook.close
1
+ #!/usr/bin/ruby -w
2
+
3
+ ###############################################################################
4
+ #
5
+ # Example of formatting using the WriteExcel module
6
+ #
7
+ # This example shows how to use a conditional numerical format
8
+ # with colours to indicate if a share price has gone up or down.
9
+ #
10
+ # reverse('©'), March 2001, John McNamara, jmcnamara@cpan.org
11
+ #
12
+ # original written in Perl by John McNamara
13
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
+ #
15
+
16
+ require 'rubygems'
17
+ require 'writeexcel'
18
+
19
+ # Create a new workbook and add a worksheet
20
+ workbook = WriteExcel.new("stocks.xls")
21
+ worksheet = workbook.add_worksheet
22
+
23
+ # Set the column width for columns 1, 2, 3 and 4
24
+ worksheet.set_column(0, 3, 15)
25
+
26
+
27
+ # Create a format for the column headings
28
+ header = workbook.add_format
29
+ header.set_bold
30
+ header.set_size(12)
31
+ header.set_color('blue')
32
+
33
+
34
+ # Create a format for the stock price
35
+ f_price = workbook.add_format
36
+ f_price.set_align('left')
37
+ f_price.set_num_format('$0.00')
38
+
39
+
40
+ # Create a format for the stock volume
41
+ f_volume = workbook.add_format
42
+ f_volume.set_align('left')
43
+ f_volume.set_num_format('#,##0')
44
+
45
+
46
+ # Create a format for the price change. This is an example of a conditional
47
+ # format. The number is formatted as a percentage. If it is positive it is
48
+ # formatted in green, if it is negative it is formatted in red and if it is
49
+ # zero it is formatted as the default font colour (in this case black).
50
+ # Note: the [Green] format produces an unappealing lime green. Try
51
+ # [Color 10] instead for a dark green.
52
+ #
53
+ f_change = workbook.add_format
54
+ f_change.set_align('left')
55
+ f_change.set_num_format('[Green]0.0%;[Red]-0.0%;0.0%')
56
+
57
+
58
+ # Write out the data
59
+ worksheet.write(0, 0, 'Company', header)
60
+ worksheet.write(0, 1, 'Price', header)
61
+ worksheet.write(0, 2, 'Volume', header)
62
+ worksheet.write(0, 3, 'Change', header)
63
+
64
+ worksheet.write(1, 0, 'Damage Inc.' )
65
+ worksheet.write(1, 1, 30.25, f_price) # $30.25
66
+ worksheet.write(1, 2, 1234567, f_volume) # 1,234,567
67
+ worksheet.write(1, 3, 0.085, f_change) # 8.5% in green
68
+
69
+ worksheet.write(2, 0, 'Dump Corp.' )
70
+ worksheet.write(2, 1, 1.56, f_price) # $1.56
71
+ worksheet.write(2, 2, 7564, f_volume) # 7,564
72
+ worksheet.write(2, 3, -0.015, f_change) # -1.5% in red
73
+
74
+ worksheet.write(3, 0, 'Rev Ltd.' )
75
+ worksheet.write(3, 1, 0.13, f_price) # $0.13
76
+ worksheet.write(3, 2, 321, f_volume) # 321
77
+ worksheet.write(3, 3, 0, f_change) # 0 in the font color (black)
78
+
79
+
80
+ workbook.close
@@ -1,30 +1,30 @@
1
- #!/usr/bin/ruby -w
2
-
3
- #######################################################################
4
- #
5
- # Example of how to set Excel worksheet tab colours.
6
- #
7
- # reverse('©'), May 2006, John McNamara, jmcnamara@cpan.org
8
- #
9
- # original written in Perl by John McNamara
10
- # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
- #
12
-
13
- require 'rubygems'
14
- require 'writeexcel'
15
-
16
- workbook = Spreadsheet::WriteExcel.new('tab_colors.xls')
17
-
18
- worksheet1 = workbook.add_worksheet
19
- worksheet2 = workbook.add_worksheet
20
- worksheet3 = workbook.add_worksheet
21
- worksheet4 = workbook.add_worksheet
22
-
23
- # Worsheet1 will have the default tab colour.
24
- worksheet2.set_tab_color('red')
25
- worksheet3.set_tab_color('green')
26
- worksheet4.set_tab_color(0x35) # Orange
27
-
28
- workbook.close
29
-
30
- workbook.close
1
+ #!/usr/bin/ruby -w
2
+
3
+ #######################################################################
4
+ #
5
+ # Example of how to set Excel worksheet tab colours.
6
+ #
7
+ # reverse('©'), May 2006, John McNamara, jmcnamara@cpan.org
8
+ #
9
+ # original written in Perl by John McNamara
10
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
11
+ #
12
+
13
+ require 'rubygems'
14
+ require 'writeexcel'
15
+
16
+ workbook = WriteExcel.new('tab_colors.xls')
17
+
18
+ worksheet1 = workbook.add_worksheet
19
+ worksheet2 = workbook.add_worksheet
20
+ worksheet3 = workbook.add_worksheet
21
+ worksheet4 = workbook.add_worksheet
22
+
23
+ # Worsheet1 will have the default tab colour.
24
+ worksheet2.set_tab_color('red')
25
+ worksheet3.set_tab_color('green')
26
+ worksheet4.set_tab_color(0x35) # Orange
27
+
28
+ workbook.close
29
+
30
+ workbook.close
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ #######################################################################
4
+ #
5
+ # Example of how to use the WriteExcel module to
6
+ # write 1D and 2D arrays of data.
7
+ #
8
+ require 'rubygems'
9
+ require 'writeexcel'
10
+
11
+ workbook = WriteExcel.new("write_arrays.xls")
12
+ worksheet1 = workbook.add_worksheet('Example 1')
13
+ worksheet2 = workbook.add_worksheet('Example 2')
14
+ worksheet3 = workbook.add_worksheet('Example 3')
15
+ worksheet4 = workbook.add_worksheet('Example 4')
16
+ worksheet5 = workbook.add_worksheet('Example 5')
17
+ worksheet6 = workbook.add_worksheet('Example 6')
18
+ worksheet7 = workbook.add_worksheet('Example 7')
19
+ worksheet8 = workbook.add_worksheet('Example 8')
20
+
21
+ format = workbook.add_format(:color => 'red', :bold => 1)
22
+ format_cmd = workbook.add_format(:color => 'blue', :bold => 1)
23
+ # Data arrays used in the following examples.
24
+ # undef values are written as blank cells (with format if specified).
25
+ #
26
+ array = [ 'one', 'two', nil, 'four' ]
27
+
28
+ array2d = [
29
+ ['maggie', 'milly', 'molly', 'may' ],
30
+ [13, 14, 15, 16 ],
31
+ ['shell', 'star', 'crab', 'stone'],
32
+ ]
33
+
34
+ # 1. Write a row of data using an array.
35
+ #
36
+ # array[0] array[1] array[2]
37
+ worksheet1.write('A1', "worksheet1.write('A3', array)", format_cmd)
38
+ worksheet1.write('A3', array)
39
+
40
+ # 2. Write a data using an array of array.
41
+ #
42
+ # array[0]
43
+ # array[1]
44
+ # array[2]
45
+ worksheet2.write('A1', "worksheet2.write('A3', [ array ])", format_cmd)
46
+ worksheet2.write('A3', [ array ])
47
+
48
+ # 3. Write a row of data using an explicit write_row() method call.
49
+ # This is the same as calling write() in Ex. 1 above.
50
+ #
51
+ worksheet3.write('A1', "worksheet3.write_row('A3', array)", format_cmd)
52
+ worksheet3.write_row('A3', array)
53
+
54
+ # 4. Write a column of data using the write_col() method call.
55
+ # This is same as Ex. 2 above.
56
+ worksheet4.write('A1', "worksheet4.write_col('A3', array)", format_cmd)
57
+ worksheet4.write_col('A3', array)
58
+
59
+ # 5. Write a 2D array in col-row order.
60
+ # array[0][0] array[1][0] ...
61
+ # array[0][1] array[1][1] ...
62
+ # array[0][2] array[1][2] ...
63
+ worksheet5.write('A1', "worksheet5.write('A3', array2d)", format_cmd)
64
+ worksheet5.write('A3', array2d)
65
+
66
+ # 6. Write a 2D array in row-col order using array of 2D array.
67
+ # array[0][0] array[0][1] ...
68
+ # array[1][0] array[1][1] ...
69
+ # array[2][0] array[2][1] ...
70
+ worksheet6.write('A1', "worksheet6.write('A3', [ array2d ] )", format_cmd)
71
+ worksheet6.write('A3', [ array2d ] )
72
+
73
+ # 7. Write a 2D array in row-col order using write_col().
74
+ # This is same as Ex. 6 above.
75
+ worksheet7.write('A1', "worksheet7.write_col('A3', array2d)", format_cmd)
76
+ worksheet7.write_col('A3', array2d)
77
+
78
+ # 8. Write a row of data with formatting. The blank cell is also formatted.
79
+ worksheet8.write('A1', "worksheet8.write('A3', array, format)", format_cmd)
80
+ worksheet8.write('A3', array, format)
81
+
82
+ workbook.close