write_xlsx 0.99.0 → 1.07.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -1
  4. data/Changes +70 -0
  5. data/README.md +1 -1
  6. data/examples/a_simple.rb +1 -1
  7. data/examples/add_vba_project.rb +1 -1
  8. data/examples/array_formula.rb +1 -1
  9. data/examples/chart_area.rb +5 -2
  10. data/examples/chart_bar.rb +5 -2
  11. data/examples/chart_clustered.rb +1 -1
  12. data/examples/chart_column.rb +5 -2
  13. data/examples/chart_combined.rb +1 -1
  14. data/examples/chart_data_labels.rb +320 -0
  15. data/examples/chart_data_table.rb +9 -3
  16. data/examples/chart_data_tools.rb +25 -7
  17. data/examples/chart_doughnut.rb +17 -5
  18. data/examples/chart_gauge.rb +73 -0
  19. data/examples/chart_line.rb +90 -12
  20. data/examples/chart_pareto.rb +1 -1
  21. data/examples/chart_pie.rb +9 -3
  22. data/examples/chart_radar.rb +13 -4
  23. data/examples/chart_scatter.rb +5 -2
  24. data/examples/chart_secondary_axis.rb +5 -2
  25. data/examples/chart_stock.rb +1 -1
  26. data/examples/chart_styles.rb +1 -1
  27. data/examples/colors.rb +1 -1
  28. data/examples/data_validate.rb +1 -1
  29. data/examples/date_time.rb +1 -1
  30. data/examples/demo.rb +4 -1
  31. data/examples/formats.rb +1 -1
  32. data/examples/headers.rb +1 -1
  33. data/examples/hide_row_col.rb +1 -1
  34. data/examples/hide_sheet.rb +1 -1
  35. data/examples/hyperlink1.rb +1 -1
  36. data/examples/indent.rb +1 -1
  37. data/examples/macros.rb +1 -1
  38. data/examples/merge1.rb +1 -1
  39. data/examples/merge2.rb +1 -1
  40. data/examples/merge3.rb +1 -1
  41. data/examples/merge4.rb +1 -1
  42. data/examples/merge5.rb +1 -1
  43. data/examples/merge6.rb +1 -1
  44. data/examples/outline.rb +1 -1
  45. data/examples/outline_collapsed.rb +1 -1
  46. data/examples/panes.rb +1 -1
  47. data/examples/properties.rb +1 -1
  48. data/examples/regions.rb +1 -1
  49. data/examples/rich_strings.rb +1 -1
  50. data/examples/right_to_left.rb +1 -1
  51. data/examples/shape1.rb +1 -1
  52. data/examples/shape2.rb +1 -1
  53. data/examples/shape3.rb +1 -1
  54. data/examples/shape4.rb +1 -1
  55. data/examples/shape5.rb +1 -1
  56. data/examples/shape6.rb +1 -1
  57. data/examples/shape7.rb +1 -1
  58. data/examples/shape8.rb +1 -1
  59. data/examples/shape_all.rb +1 -1
  60. data/examples/sparklines1.rb +1 -1
  61. data/examples/sparklines2.rb +1 -1
  62. data/examples/stats.rb +1 -1
  63. data/examples/stats_ext.rb +1 -1
  64. data/examples/stocks.rb +1 -1
  65. data/examples/tab_colors.rb +1 -1
  66. data/examples/tables.rb +78 -43
  67. data/lib/write_xlsx/chart.rb +163 -34
  68. data/lib/write_xlsx/chart/area.rb +1 -1
  69. data/lib/write_xlsx/chart/bar.rb +1 -1
  70. data/lib/write_xlsx/chart/column.rb +1 -1
  71. data/lib/write_xlsx/chart/doughnut.rb +1 -1
  72. data/lib/write_xlsx/chart/line.rb +16 -2
  73. data/lib/write_xlsx/chart/pie.rb +21 -8
  74. data/lib/write_xlsx/chart/radar.rb +1 -1
  75. data/lib/write_xlsx/chart/scatter.rb +1 -1
  76. data/lib/write_xlsx/chart/series.rb +100 -0
  77. data/lib/write_xlsx/chart/stock.rb +1 -1
  78. data/lib/write_xlsx/chartsheet.rb +5 -5
  79. data/lib/write_xlsx/drawing.rb +86 -30
  80. data/lib/write_xlsx/format.rb +5 -5
  81. data/lib/write_xlsx/package/comments.rb +11 -11
  82. data/lib/write_xlsx/package/relationships.rb +4 -4
  83. data/lib/write_xlsx/package/styles.rb +26 -8
  84. data/lib/write_xlsx/package/table.rb +8 -7
  85. data/lib/write_xlsx/package/vml.rb +20 -19
  86. data/lib/write_xlsx/shape.rb +4 -3
  87. data/lib/write_xlsx/sheets.rb +18 -16
  88. data/lib/write_xlsx/sparkline.rb +1 -1
  89. data/lib/write_xlsx/utility.rb +40 -7
  90. data/lib/write_xlsx/version.rb +1 -1
  91. data/lib/write_xlsx/workbook.rb +69 -44
  92. data/lib/write_xlsx/worksheet.rb +206 -138
  93. data/lib/write_xlsx/worksheet/hyperlink.rb +16 -37
  94. data/test/drawing/test_drawing_chart_01.rb +6 -2
  95. data/test/drawing/test_drawing_image_01.rb +12 -3
  96. data/test/drawing/test_drawing_shape_01.rb +8 -5
  97. data/test/drawing/test_drawing_shape_02.rb +12 -5
  98. data/test/drawing/test_drawing_shape_03.rb +8 -5
  99. data/test/drawing/test_drawing_shape_04.rb +8 -24
  100. data/test/drawing/test_drawing_shape_05.rb +8 -5
  101. data/test/drawing/test_drawing_shape_06.rb +11 -6
  102. data/test/drawing/test_drawing_shape_07.rb +11 -6
  103. data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
  104. data/test/drawing/test_write_c_chart.rb +1 -1
  105. data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +1 -1
  106. data/test/drawing/test_write_c_nv_pr.rb +1 -1
  107. data/test/drawing/test_write_col.rb +1 -1
  108. data/test/drawing/test_write_col_off.rb +1 -1
  109. data/test/drawing/test_write_ext.rb +1 -1
  110. data/test/drawing/test_write_pos.rb +1 -1
  111. data/test/drawing/test_write_row.rb +1 -1
  112. data/test/drawing/test_write_row_off.rb +1 -1
  113. data/test/drawing/test_write_xfrm_extension.rb +1 -1
  114. data/test/drawing/test_write_xfrm_offset.rb +1 -1
  115. data/test/perl_output/chart_data_labels.xlsx +0 -0
  116. data/test/perl_output/chart_gauge.xlsx +0 -0
  117. data/test/perl_output/chart_line.xlsx +0 -0
  118. data/test/perl_output/comments2.xlsx +0 -0
  119. data/test/perl_output/tables.xlsx +0 -0
  120. data/test/regression/images/red2.png +0 -0
  121. data/test/regression/test_array_formula04.rb +31 -0
  122. data/test/regression/test_chart_axis26.rb +10 -8
  123. data/test/regression/test_chart_axis27.rb +1 -1
  124. data/test/regression/test_chart_axis28.rb +1 -1
  125. data/test/regression/test_chart_axis29.rb +1 -1
  126. data/test/regression/test_chart_axis33.rb +1 -1
  127. data/test/regression/test_chart_axis44.rb +54 -0
  128. data/test/regression/test_chart_axis45.rb +54 -0
  129. data/test/regression/test_chart_axis46.rb +54 -0
  130. data/test/regression/test_chart_combined10.rb +43 -0
  131. data/test/regression/test_chart_combined11.rb +63 -0
  132. data/test/regression/test_chart_data_labels25.rb +1 -1
  133. data/test/regression/test_chart_data_labels26.rb +44 -0
  134. data/test/regression/test_chart_data_labels27.rb +44 -0
  135. data/test/regression/test_chart_data_labels28.rb +52 -0
  136. data/test/regression/test_chart_data_labels29.rb +43 -0
  137. data/test/regression/test_chart_data_labels30.rb +46 -0
  138. data/test/regression/test_chart_data_labels31.rb +49 -0
  139. data/test/regression/test_chart_data_labels32.rb +54 -0
  140. data/test/regression/test_chart_data_labels33.rb +52 -0
  141. data/test/regression/test_chart_data_labels34.rb +54 -0
  142. data/test/regression/test_chart_data_labels35.rb +46 -0
  143. data/test/regression/test_chart_data_labels36.rb +54 -0
  144. data/test/regression/test_chart_data_labels37.rb +51 -0
  145. data/test/regression/test_chart_data_labels38.rb +54 -0
  146. data/test/regression/test_chart_data_labels39.rb +53 -0
  147. data/test/regression/test_chart_data_labels40.rb +53 -0
  148. data/test/regression/test_chart_data_labels41.rb +54 -0
  149. data/test/regression/test_chart_data_labels42.rb +58 -0
  150. data/test/regression/test_chart_data_labels43.rb +58 -0
  151. data/test/regression/test_chart_data_labels44.rb +56 -0
  152. data/test/regression/test_chart_data_labels45.rb +57 -0
  153. data/test/regression/test_chart_data_labels46.rb +61 -0
  154. data/test/regression/test_chart_data_labels47.rb +61 -0
  155. data/test/regression/test_chart_doughnut07.rb +37 -0
  156. data/test/regression/test_chart_font09.rb +1 -1
  157. data/test/regression/test_chart_line05.rb +43 -0
  158. data/test/regression/test_chart_line06.rb +43 -0
  159. data/test/regression/test_chart_size03.rb +4 -1
  160. data/test/regression/test_comment14.rb +29 -0
  161. data/test/regression/test_comment15.rb +28 -0
  162. data/test/regression/test_comment16.rb +34 -0
  163. data/test/regression/test_header_image15.rb +36 -0
  164. data/test/regression/test_header_image16.rb +42 -0
  165. data/test/regression/test_header_image17.rb +46 -0
  166. data/test/regression/test_header_image18.rb +48 -0
  167. data/test/regression/test_header_image19.rb +36 -0
  168. data/test/regression/test_hyperlink32.rb +27 -0
  169. data/test/regression/test_hyperlink33.rb +28 -0
  170. data/test/regression/test_hyperlink34.rb +33 -0
  171. data/test/regression/test_hyperlink35.rb +39 -0
  172. data/test/regression/test_hyperlink36.rb +34 -0
  173. data/test/regression/test_hyperlink37.rb +33 -0
  174. data/test/regression/test_hyperlink38.rb +27 -0
  175. data/test/regression/test_hyperlink39.rb +27 -0
  176. data/test/regression/test_hyperlink40.rb +27 -0
  177. data/test/regression/test_hyperlink41.rb +27 -0
  178. data/test/regression/test_hyperlink42.rb +27 -0
  179. data/test/regression/test_hyperlink43.rb +27 -0
  180. data/test/regression/test_hyperlink44.rb +27 -0
  181. data/test/regression/test_hyperlink45.rb +27 -0
  182. data/test/regression/test_hyperlink47.rb +27 -0
  183. data/test/regression/test_hyperlink48.rb +31 -0
  184. data/test/regression/test_hyperlink49.rb +29 -0
  185. data/test/regression/test_image06.rb +5 -5
  186. data/test/regression/test_image08.rb +5 -4
  187. data/test/regression/test_image15.rb +4 -2
  188. data/test/regression/test_image28.rb +1 -1
  189. data/test/regression/test_image44.rb +28 -0
  190. data/test/regression/test_image45.rb +29 -0
  191. data/test/regression/test_image46.rb +29 -0
  192. data/test/regression/test_image47.rb +28 -0
  193. data/test/regression/test_image48.rb +32 -0
  194. data/test/regression/test_image49.rb +38 -0
  195. data/test/regression/test_image50.rb +24 -0
  196. data/test/regression/test_image51.rb +30 -0
  197. data/test/regression/test_object_position01.rb +26 -0
  198. data/test/regression/test_object_position02.rb +26 -0
  199. data/test/regression/test_object_position03.rb +26 -0
  200. data/test/regression/test_object_position04.rb +44 -0
  201. data/test/regression/test_object_position06.rb +28 -0
  202. data/test/regression/test_object_position07.rb +28 -0
  203. data/test/regression/test_object_position08.rb +47 -0
  204. data/test/regression/test_object_position09.rb +50 -0
  205. data/test/regression/test_object_position10.rb +28 -0
  206. data/test/regression/test_object_position12.rb +25 -0
  207. data/test/regression/test_object_position13.rb +25 -0
  208. data/test/regression/test_object_position14.rb +25 -0
  209. data/test/regression/test_object_position15.rb +29 -0
  210. data/test/regression/test_object_position16.rb +29 -0
  211. data/test/regression/test_object_position17.rb +29 -0
  212. data/test/regression/test_object_position18.rb +29 -0
  213. data/test/regression/test_object_position19.rb +29 -0
  214. data/test/regression/test_object_position20.rb +29 -0
  215. data/test/regression/test_shape_connect01.rb +4 -2
  216. data/test/regression/test_table24.rb +27 -0
  217. data/test/regression/test_table25.rb +27 -0
  218. data/test/regression/xlsx_files/array_formula04.xlsx +0 -0
  219. data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
  220. data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
  221. data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
  222. data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
  223. data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
  224. data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
  225. data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
  226. data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
  227. data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
  228. data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
  229. data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
  230. data/test/regression/xlsx_files/chart_data_labels26.xlsx +0 -0
  231. data/test/regression/xlsx_files/chart_data_labels27.xlsx +0 -0
  232. data/test/regression/xlsx_files/chart_data_labels28.xlsx +0 -0
  233. data/test/regression/xlsx_files/chart_data_labels29.xlsx +0 -0
  234. data/test/regression/xlsx_files/chart_data_labels30.xlsx +0 -0
  235. data/test/regression/xlsx_files/chart_data_labels31.xlsx +0 -0
  236. data/test/regression/xlsx_files/chart_data_labels32.xlsx +0 -0
  237. data/test/regression/xlsx_files/chart_data_labels33.xlsx +0 -0
  238. data/test/regression/xlsx_files/chart_data_labels34.xlsx +0 -0
  239. data/test/regression/xlsx_files/chart_data_labels35.xlsx +0 -0
  240. data/test/regression/xlsx_files/chart_data_labels36.xlsx +0 -0
  241. data/test/regression/xlsx_files/chart_data_labels37.xlsx +0 -0
  242. data/test/regression/xlsx_files/chart_data_labels38.xlsx +0 -0
  243. data/test/regression/xlsx_files/chart_data_labels39.xlsx +0 -0
  244. data/test/regression/xlsx_files/chart_data_labels40.xlsx +0 -0
  245. data/test/regression/xlsx_files/chart_data_labels41.xlsx +0 -0
  246. data/test/regression/xlsx_files/chart_data_labels42.xlsx +0 -0
  247. data/test/regression/xlsx_files/chart_data_labels43.xlsx +0 -0
  248. data/test/regression/xlsx_files/chart_data_labels44.xlsx +0 -0
  249. data/test/regression/xlsx_files/chart_data_labels45.xlsx +0 -0
  250. data/test/regression/xlsx_files/chart_data_labels46.xlsx +0 -0
  251. data/test/regression/xlsx_files/chart_data_labels47.xlsx +0 -0
  252. data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
  253. data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
  254. data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
  255. data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
  256. data/test/regression/xlsx_files/comment14.xlsx +0 -0
  257. data/test/regression/xlsx_files/comment15.xlsx +0 -0
  258. data/test/regression/xlsx_files/comment16.xlsx +0 -0
  259. data/test/regression/xlsx_files/header_image15.xlsx +0 -0
  260. data/test/regression/xlsx_files/header_image16.xlsx +0 -0
  261. data/test/regression/xlsx_files/header_image17.xlsx +0 -0
  262. data/test/regression/xlsx_files/header_image18.xlsx +0 -0
  263. data/test/regression/xlsx_files/header_image19.xlsx +0 -0
  264. data/test/regression/xlsx_files/hyperlink32.xlsx +0 -0
  265. data/test/regression/xlsx_files/hyperlink33.xlsx +0 -0
  266. data/test/regression/xlsx_files/hyperlink34.xlsx +0 -0
  267. data/test/regression/xlsx_files/hyperlink35.xlsx +0 -0
  268. data/test/regression/xlsx_files/hyperlink36.xlsx +0 -0
  269. data/test/regression/xlsx_files/hyperlink37.xlsx +0 -0
  270. data/test/regression/xlsx_files/hyperlink38.xlsx +0 -0
  271. data/test/regression/xlsx_files/hyperlink39.xlsx +0 -0
  272. data/test/regression/xlsx_files/hyperlink40.xlsx +0 -0
  273. data/test/regression/xlsx_files/hyperlink41.xlsx +0 -0
  274. data/test/regression/xlsx_files/hyperlink42.xlsx +0 -0
  275. data/test/regression/xlsx_files/hyperlink43.xlsx +0 -0
  276. data/test/regression/xlsx_files/hyperlink44.xlsx +0 -0
  277. data/test/regression/xlsx_files/hyperlink45.xlsx +0 -0
  278. data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
  279. data/test/regression/xlsx_files/hyperlink47.xlsx +0 -0
  280. data/test/regression/xlsx_files/hyperlink48.xlsx +0 -0
  281. data/test/regression/xlsx_files/hyperlink49.xlsx +0 -0
  282. data/test/regression/xlsx_files/image06.xlsx +0 -0
  283. data/test/regression/xlsx_files/image44.xlsx +0 -0
  284. data/test/regression/xlsx_files/image45.xlsx +0 -0
  285. data/test/regression/xlsx_files/image46.xlsx +0 -0
  286. data/test/regression/xlsx_files/image47.xlsx +0 -0
  287. data/test/regression/xlsx_files/image48.xlsx +0 -0
  288. data/test/regression/xlsx_files/image49.xlsx +0 -0
  289. data/test/regression/xlsx_files/image50.xlsx +0 -0
  290. data/test/regression/xlsx_files/image51.xlsx +0 -0
  291. data/test/regression/xlsx_files/object_position01.xlsx +0 -0
  292. data/test/regression/xlsx_files/object_position02.xlsx +0 -0
  293. data/test/regression/xlsx_files/object_position03.xlsx +0 -0
  294. data/test/regression/xlsx_files/object_position04.xlsx +0 -0
  295. data/test/regression/xlsx_files/object_position06.xlsx +0 -0
  296. data/test/regression/xlsx_files/object_position07.xlsx +0 -0
  297. data/test/regression/xlsx_files/object_position08.xlsx +0 -0
  298. data/test/regression/xlsx_files/object_position09.xlsx +0 -0
  299. data/test/regression/xlsx_files/object_position10.xlsx +0 -0
  300. data/test/regression/xlsx_files/object_position12.xlsx +0 -0
  301. data/test/regression/xlsx_files/object_position13.xlsx +0 -0
  302. data/test/regression/xlsx_files/object_position14.xlsx +0 -0
  303. data/test/regression/xlsx_files/object_position15.xlsx +0 -0
  304. data/test/regression/xlsx_files/object_position16.xlsx +0 -0
  305. data/test/regression/xlsx_files/object_position17.xlsx +0 -0
  306. data/test/regression/xlsx_files/object_position18.xlsx +0 -0
  307. data/test/regression/xlsx_files/object_position19.xlsx +0 -0
  308. data/test/regression/xlsx_files/object_position20.xlsx +0 -0
  309. data/test/regression/xlsx_files/table24.xlsx +0 -0
  310. data/test/regression/xlsx_files/table25.xlsx +0 -0
  311. data/test/test_example_match.rb +1268 -780
  312. data/test/workbook/test_check_sheetname.rb +51 -0
  313. data/write_xlsx.gemspec +1 -0
  314. metadata +367 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8880984e96fe4a8788fe6642220163ff36932dea018a335d00165a7b2d2ae04
4
- data.tar.gz: 99153b43aba51974cca58ed8c38d6308814820846b4617444fcd302752843bc5
3
+ metadata.gz: 677847fdb975ab7253b3a5ed5f6aa779a9bbf2a459e941f5037b7d557e2abfe4
4
+ data.tar.gz: 4c4b0b03ce3b510a0ad6423c30a76fc778463afe92f992da52b49bbe65c7a1ac
5
5
  SHA512:
6
- metadata.gz: 1b5c868f6e42846e925282b0eed02064b4541e852e72012e083009dbaa44e6bc419f1ad5b630cfe3ca149b12832732b972f340e6038502e1c8acbce9358702d2
7
- data.tar.gz: 8bc6c84b0bb6c5901516441c7a5b1e45044ba5c26d30c92ac773f0de521e8e78785cd8aa4759a0d0db96d629aedd4aaf2a7453cb1f075b36dd1e61fc34cb217d
6
+ metadata.gz: b3f81d2d54e5f7a7170c34e7666f58c7f4f77b993ff3b95263327b0ff8edff5c9a0b1a6ea825ece5b43c5b1d2b91a6f01764237f22ee6442bd8c747de8e04150
7
+ data.tar.gz: 3e49064459345dbcc5d97fef0f8154159776e8361cb0709e8a4564f32dd062fe95b6e4f08976df81b5ac478a40287be9a33086726444af3c75d1cbeb5c869dc2
data/.gitignore CHANGED
@@ -6,6 +6,7 @@ GTAGS
6
6
  .bundle
7
7
  .config
8
8
  .yardoc
9
+ .byebug_history
9
10
  Gemfile.lock
10
11
  InstalledFiles
11
12
  _site
data/.travis.yml CHANGED
@@ -63,4 +63,3 @@ rvm:
63
63
  - 2.1.1
64
64
  - 2.1.0
65
65
  - 2.0.0
66
- - 1.9.3
data/Changes CHANGED
@@ -1,5 +1,75 @@
1
1
  Change history of write_xlsx rubygem.
2
2
 
3
+ 2021-02-17 v1.07.0
4
+
5
+ Added support for Border, Fill, Pattern and Gradient formatting to chart
6
+ data labels and chart custom data labels.
7
+
8
+
9
+ 2021-02-15 v1.06.0
10
+
11
+ Fix for issue where array formulas weren't included in the output file
12
+ for certain ranges/conditions.
13
+
14
+
15
+ 2021-02-15 v1.05.0
16
+
17
+ Added support for custom data labels in charts.
18
+
19
+ Remove ruby-1.9.3 travil CI check.
20
+
21
+
22
+ 2021-02-14 v1.04.0
23
+
24
+ Added support for "stacked" and "percent_stacked" Line charts.
25
+
26
+ Fix for worksheet objects (charts and images) that are inserted with an
27
+ offset that starts in a hidden cell.
28
+
29
+ Removed error in add_worksheet() for sheet name "History" which is a
30
+ reserved name in English version of Excel. However, this is an allowed
31
+ worksheet name in some Excel variants so the warning has been turned into
32
+ a documentation note instead.
33
+
34
+
35
+ 2021-02-13 v1.03.0
36
+
37
+ Fix for duplicate images being copied to an Excel::Writer::XLSX
38
+ file. Excel uses an optimization where it only stores one copy of a
39
+ repeated/duplicate image in a workbook. WriteXLSX didn't do
40
+ this which meant that the file size would increase when then was a large
41
+ number of repeated images. This release fixes that issue and replicates
42
+ Excel's behaviour.
43
+
44
+ 2021-02-12 v1.02.0
45
+
46
+ Added support for hyperlinks in worksheet images.
47
+
48
+ Increased allowable url length from 255 to 2079 characters, as allowed in
49
+ more recent versions of Excel.
50
+
51
+
52
+ 2021-02-08 v1.01.0
53
+
54
+ Added support for stacked and East Asian vertical chart fonts.
55
+
56
+ Added option to control positioning of charts or images when cells are
57
+ resized.
58
+
59
+ Added support for combining Pie/Doughnut charts.
60
+
61
+ Fixed sizing of cell comment boxes when they cross columns/rows that have
62
+ size changes that occur after the comment is written. Comments should
63
+ now behave like other worksheet objects such as images and charts.
64
+
65
+ Fix for structured reference in chart ranges.
66
+
67
+ 2021-01-23 v1.00.0
68
+
69
+ Fixed issue where images that started in hidden rows/columns weren't placed
70
+ correctly in the worksheet.
71
+
72
+
3
73
  2021-01-08 v0.99.0
4
74
 
5
75
  Added font and font_size parameters to write_comment().
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  gem to create a new file in the Excel 2007+ XLSX format, and you can use the
7
7
  same interface as writeexcel gem. write_xlsx is converted from Perl's module
8
- [Excel::Writer::XLSX-0.99](https://github.com/jmcnamara/excel-writer-xlsx) .
8
+ [Excel::Writer::XLSX-1.07](https://github.com/jmcnamara/excel-writer-xlsx/tree/CPAN_1.07)
9
9
 
10
10
  ## Description
11
11
 
data/examples/a_simple.rb CHANGED
@@ -7,7 +7,7 @@
7
7
  # write text and numbers to an Excel xlsx file.
8
8
  #
9
9
  # reverse(c), March 2001, John McNamara, jmcnamara@cpan.org
10
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
10
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
11
11
  #
12
12
 
13
13
  require 'write_xlsx'
@@ -10,7 +10,7 @@
10
10
  # used to extract the vbaProject.bin file.
11
11
  #
12
12
  # reverse('(c)'), November 2012, John McNamara, jmcnamara@cpan.org
13
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
13
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
14
14
  #
15
15
 
16
16
  require 'write_xlsx'
@@ -7,7 +7,7 @@
7
7
  # array formulas.
8
8
  #
9
9
  # reverse(c), August 2004, John McNamara, jmcnamara@cpan.org
10
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
10
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
11
11
  #
12
12
 
13
13
  require 'write_xlsx'
@@ -6,7 +6,7 @@
6
6
  # A demo of an Area chart in Excel::Writer::XLSX.
7
7
  #
8
8
  # reverse('ゥ'), March 2011, John McNamara, jmcnamara@cpan.org
9
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
9
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
10
10
  #
11
11
 
12
12
  require 'write_xlsx'
@@ -53,6 +53,9 @@
53
53
  chart.set_style(11)
54
54
 
55
55
  # Insert the chart into the worksheet (with an offset).
56
- worksheet.insert_chart('D2', chart, 25, 10)
56
+ worksheet.insert_chart(
57
+ 'D2', chart,
58
+ :x_offset => 25, :y_offset => 10
59
+ )
57
60
 
58
61
  workbook.close
@@ -6,7 +6,7 @@
6
6
  # A demo of an Bar chart in Excel::Writer::XLSX.
7
7
  #
8
8
  # reverse('c'), March 2011, John McNamara, jmcnamara@cpan.org
9
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
9
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
10
10
  #
11
11
 
12
12
  require 'write_xlsx'
@@ -53,6 +53,9 @@
53
53
  chart.set_style(11)
54
54
 
55
55
  # Insert the chart into the worksheet (with an offset).
56
- worksheet.insert_chart('D2', chart, 25, 10)
56
+ worksheet.insert_chart(
57
+ 'D2', chart,
58
+ :x_offset => 25, :y_offset => 10
59
+ )
57
60
 
58
61
  workbook.close
@@ -5,7 +5,7 @@
5
5
  # A demo of a clustered category chart in Excel::Writer::XLSX.
6
6
  #
7
7
  # reverse ('(c)'), March 2015, John McNamara, jmcnamara@cpan.org
8
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
8
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
9
9
  #
10
10
 
11
11
  require 'write_xlsx'
@@ -6,7 +6,7 @@
6
6
  # A demo of an Area chart in Excel::Writer::XLSX.
7
7
  #
8
8
  # reverse('ゥ'), March 2011, John McNamara, jmcnamara@cpan.org
9
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
9
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
10
10
  #
11
11
 
12
12
  require 'write_xlsx'
@@ -53,6 +53,9 @@
53
53
  chart.set_style(11)
54
54
 
55
55
  # Insert the chart into the worksheet (with an offset).
56
- worksheet.insert_chart('D2', chart, 25, 10)
56
+ worksheet.insert_chart(
57
+ 'D2', chart,
58
+ :x_offset => 25, :y_offset => 10
59
+ )
57
60
 
58
61
  workbook.close
@@ -6,7 +6,7 @@
6
6
  # An example of a Combined chart in WriteXLSX.
7
7
  #
8
8
  # reverse ('(c)'), March 2015, John McNamara, jmcnamara@cpan.org
9
- # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
9
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
10
10
  #
11
11
 
12
12
  require 'write_xlsx'
@@ -0,0 +1,320 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ #######################################################################
5
+ #
6
+ # A demo of an various Excel chart data label features that are available
7
+ # via an WriteXLSX chart.
8
+ #
9
+ # Copyright 2000-2020, John McNamara, jmcnamara@cpan.org
10
+ # convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
11
+ #
12
+
13
+ require 'write_xlsx'
14
+
15
+ workbook = WriteXLSX.new('chart_data_labels.xlsx')
16
+ worksheet = workbook.add_worksheet
17
+ bold = workbook.add_format(:bold => 1)
18
+
19
+ # Add the worksheet data that the charts will refer to.
20
+ headings = ['Number', 'Data', 'Text']
21
+ data = [
22
+ [ 2, 3, 4, 5, 6, 7 ],
23
+ [20, 10, 20, 30, 40, 30 ],
24
+ ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
25
+ ]
26
+
27
+ worksheet.write('A1', headings, bold)
28
+ worksheet.write('A2', data)
29
+
30
+
31
+ #######################################################################
32
+ #
33
+ # Example with standard data labels.
34
+ #
35
+
36
+ # Create a Column chart.
37
+ chart1 = workbook.add_chart(:type => 'column', :embedded => 1)
38
+
39
+ # Configure the data series and add the data labels.
40
+ chart1.add_series(
41
+ :categories => '=Sheet1!$A$2:$A$7',
42
+ :values => '=Sheet1!$B$2:$B$7',
43
+ :data_labels => { :value => 1 }
44
+ )
45
+
46
+ # Add a chart title.
47
+ chart1.set_title(:name => 'Chart with standard data labels')
48
+
49
+ # Turn off the chart legend.
50
+ chart1.set_legend(:none => 1)
51
+
52
+ # Insert the chart into the worksheet (with an offset).
53
+ worksheet.insert_chart('D2', chart1, { :x_offset => 25, :y_offset => 10 })
54
+
55
+
56
+ #######################################################################
57
+ #
58
+ # Example with value and category data labels.
59
+ #
60
+
61
+ # Create a Column chart.
62
+ chart2 = workbook.add_chart(:type => 'column', :embedded => 1)
63
+
64
+ # Configure the data series and add the data labels.
65
+ chart2.add_series(
66
+ :categories => '=Sheet1!$A$2:$A$7',
67
+ :values => '=Sheet1!$B$2:$B$7',
68
+ :data_labels => { :value => 1, :category => 1 }
69
+ )
70
+
71
+ # Add a chart title.
72
+ chart2.set_title(:name => 'Category and Value data labels')
73
+
74
+ # Turn off the chart legend.
75
+ chart2.set_legend(:none => 1)
76
+
77
+ # Insert the chart into the worksheet (with an offset).
78
+ worksheet.insert_chart('D18', chart2, { :x_offset => 25, :y_offset => 10 })
79
+
80
+
81
+ #######################################################################
82
+ #
83
+ # Example with standard data labels with different font.
84
+ #
85
+
86
+ # Create a Column chart.
87
+ chart3 = workbook.add_chart(:type => 'column', :embedded => 1)
88
+
89
+ # Configure the data series and add the data labels.
90
+ chart3.add_series(
91
+ :categories => '=Sheet1!$A$2:$A$7',
92
+ :values => '=Sheet1!$B$2:$B$7',
93
+ :data_labels => { :value => 1,
94
+ :font => {:bold => 1,
95
+ :color => 'red',
96
+ :rotation => -30}
97
+ }
98
+ )
99
+
100
+ # Add a chart title.
101
+ chart3.set_title(:name => 'Data labels with user defined font')
102
+
103
+ # Turn off the chart legend.
104
+ chart3.set_legend(:none => 1)
105
+
106
+ # Insert the chart into the worksheet (with an offset).
107
+ worksheet.insert_chart('D34', chart3, { :x_offset => 25, :y_offset => 10 })
108
+
109
+
110
+ #######################################################################
111
+ #
112
+ # Example with custom string data labels.
113
+ #
114
+
115
+ # Create a Column chart.
116
+ chart4 = workbook.add_chart(:type => 'column', :embedded => 1)
117
+
118
+ # Configure the data series and add the data labels.
119
+ chart4.add_series(
120
+ :categories => '=Sheet1!$A$2:$A$7',
121
+ :values => '=Sheet1!$B$2:$B$7',
122
+ :data_labels => {
123
+ :value => 1,
124
+ :border => {:color => 'red'},
125
+ :fill => {:color => 'yellow'}
126
+ }
127
+ )
128
+
129
+ # Add a chart title.
130
+ chart4.set_title(:name => 'Data labels with formatting')
131
+
132
+ # Turn off the chart legend.
133
+ chart4.set_legend(:none => 1)
134
+
135
+ # Insert the chart into the worksheet (with an offset).
136
+ worksheet.insert_chart('D50', chart4, { :x_offset => 25, :y_offset => 10 })
137
+
138
+
139
+ #######################################################################
140
+ #
141
+ # Example with custom string data labels.
142
+ #
143
+
144
+ # Create a Column chart.
145
+ chart5 = workbook.add_chart( :type => 'column', :embedded => 1 )
146
+
147
+ # Some custom labels.
148
+ custom_labels = [
149
+ { :value => 'Amy' },
150
+ { :value => 'Bea' },
151
+ { :value => 'Eva' },
152
+ { :value => 'Fay' },
153
+ { :value => 'Liv' },
154
+ { :value => 'Una' }
155
+ ]
156
+
157
+ # Configure the data series and add the data labels.
158
+ chart5.add_series(
159
+ :categories => '=Sheet1!$A$2:$A$7',
160
+ :values => '=Sheet1!$B$2:$B$7',
161
+ :data_labels => { :value => 1, :custom => custom_labels }
162
+ )
163
+
164
+ # Add a chart title.
165
+ chart5.set_title(:name => 'Chart with custom string data labels')
166
+
167
+ # Turn off the chart legend.
168
+ chart5.set_legend(:none => 1)
169
+
170
+ # Insert the chart into the worksheet (with an offset).
171
+ worksheet.insert_chart('D66', chart5, { :x_offset => 25, :y_offset => 10 })
172
+
173
+
174
+ #######################################################################
175
+ #
176
+ # Example with custom data labels from cells.
177
+ #
178
+
179
+ # Create a Column chart.
180
+ chart6 = workbook.add_chart(:type => 'column', :embedded => 1)
181
+
182
+ # Some custom labels.
183
+ custom_labels = [
184
+ { :value => '=Sheet1!$C$2' },
185
+ { :value => '=Sheet1!$C$3' },
186
+ { :value => '=Sheet1!$C$4' },
187
+ { :value => '=Sheet1!$C$5' },
188
+ { :value => '=Sheet1!$C$6' },
189
+ { :value => '=Sheet1!$C$7' }
190
+ ]
191
+
192
+
193
+ # Configure the data series and add the data labels.
194
+ chart6.add_series(
195
+ :categories => '=Sheet1!$A$2:$A$7',
196
+ :values => '=Sheet1!$B$2:$B$7',
197
+ :data_labels => { :value => 1, :custom => custom_labels }
198
+ )
199
+
200
+ # Add a chart title.
201
+ chart6.set_title(:name => 'Chart with custom data labels from cells')
202
+
203
+ # Turn off the chart legend.
204
+ chart6.set_legend(:none => 1)
205
+
206
+ # Insert the chart into the worksheet (with an offset).
207
+ worksheet.insert_chart('D82', chart6, { :x_offset => 25, :y_offset => 10 })
208
+
209
+
210
+ #######################################################################
211
+ #
212
+ # Example with custom and default data labels.
213
+ #
214
+
215
+ # Create a Column chart.
216
+ chart7 = workbook.add_chart(:type => 'column', :embedded => 1)
217
+
218
+ # Some custom labels. The nil items will get the default value.
219
+ # We also set a font for the custom items as an extra example.
220
+ custom_labels = [
221
+ { :value => '=Sheet1!$C$2', :font => { :color => 'red' } },
222
+ nil,
223
+ { :value => '=Sheet1!$C$4', :font => { :color => 'red' } },
224
+ { :value => '=Sheet1!$C$5', :font => { :color => 'red' } }
225
+ ]
226
+
227
+
228
+ # Configure the data series and add the data labels.
229
+ chart7.add_series(
230
+ :categories => '=Sheet1!$A$2:$A$7',
231
+ :values => '=Sheet1!$B$2:$B$7',
232
+ :data_labels => { :value => 1, :custom => custom_labels }
233
+ )
234
+
235
+ # Add a chart title.
236
+ chart7.set_title(:name => 'Mixed custom and default data labels')
237
+
238
+ # Turn off the chart legend.
239
+ chart7.set_legend(:none => 1)
240
+
241
+ # Insert the chart into the worksheet (with an offset).
242
+ worksheet.insert_chart('D98', chart7, { :x_offset => 25, :y_offset => 10 })
243
+
244
+
245
+ #######################################################################
246
+ #
247
+ # Example with deleted custom data labels.
248
+ #
249
+
250
+ # Create a Column chart.
251
+ chart8 = workbook.add_chart(:type => 'column', :embedded => 1)
252
+
253
+ # Some deleted custom labels and defaults (nil). This allows us to
254
+ # highlight certain values such as the minimum and maximum.
255
+ custom_labels = [
256
+ { :delete => 1 },
257
+ nil,
258
+ { :delete => 1 },
259
+ { :delete => 1 },
260
+ nil,
261
+ { :delete => 1 }
262
+ ]
263
+
264
+ # Configure the data series and add the data labels.
265
+ chart8.add_series(
266
+ :categories => '=Sheet1!$A$2:$A$7',
267
+ :values => '=Sheet1!$B$2:$B$7',
268
+ :data_labels => { :value => 1, :custom => custom_labels }
269
+ )
270
+
271
+ # Add a chart title.
272
+ chart8.set_title(:name => 'Chart with deleted data labels')
273
+
274
+ # Turn off the chart legend.
275
+ chart8.set_legend(:none => 1)
276
+
277
+ # Insert the chart into the worksheet (with an offset).
278
+ worksheet.insert_chart('D114', chart8, { :x_offset => 25, :y_offset => 10 })
279
+
280
+ #######################################################################
281
+ #
282
+ # Example with custom string data labels and formatting.
283
+ #
284
+
285
+ # Create a Column chart.
286
+ chart9 = workbook.add_chart( :type => 'column', :embedded => 1 )
287
+
288
+ # Some custom labels.
289
+ custom_labels = [
290
+ { :value => 'Amy', :border => {:color => 'blue'} },
291
+ { :value => 'Bea' },
292
+ { :value => 'Eva' },
293
+ { :value => 'Fay' },
294
+ { :value => 'Liv' },
295
+ { :value => 'Una', :fill => {:color => 'green'} }
296
+ ]
297
+
298
+
299
+ # Configure the data series and add the data labels.
300
+ chart9.add_series(
301
+ :categories => '=Sheet1!$A$2:$A$7',
302
+ :values => '=Sheet1!$B$2:$B$7',
303
+ :data_labels => {
304
+ :value => 1,
305
+ :custom => custom_labels,
306
+ :border => {:color => 'red'},
307
+ :fill => {:color => 'yellow'}
308
+ }
309
+ )
310
+
311
+ # Add a chart title.
312
+ chart9.set_title( :name => 'Chart with custom labels and formatting' )
313
+
314
+ # Turn off the chart legend.
315
+ chart9.set_legend( :none => 1 )
316
+
317
+ # Insert the chart into the worksheet (with an offset).
318
+ worksheet.insert_chart( 'D130', chart9, { :x_offset => 25, :y_offset => 10 } )
319
+
320
+ workbook.close