write_xlsx 0.85.9 → 1.09.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1390) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +53 -1
  4. data/Changes +242 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +5 -5
  7. data/examples/a_simple.rb +2 -7
  8. data/examples/add_vba_project.rb +1 -1
  9. data/examples/array_formula.rb +1 -1
  10. data/examples/background.rb +19 -0
  11. data/examples/chart_area.rb +5 -2
  12. data/examples/chart_bar.rb +5 -2
  13. data/examples/chart_clustered.rb +1 -1
  14. data/examples/chart_column.rb +5 -2
  15. data/examples/chart_combined.rb +4 -2
  16. data/examples/chart_data_labels.rb +320 -0
  17. data/examples/chart_data_table.rb +9 -3
  18. data/examples/chart_data_tools.rb +25 -7
  19. data/examples/chart_doughnut.rb +17 -5
  20. data/examples/chart_gauge.rb +73 -0
  21. data/examples/chart_line.rb +90 -12
  22. data/examples/chart_pareto.rb +1 -1
  23. data/examples/chart_pie.rb +9 -3
  24. data/examples/chart_radar.rb +13 -4
  25. data/examples/chart_scatter.rb +5 -2
  26. data/examples/chart_secondary_axis.rb +5 -2
  27. data/examples/chart_stock.rb +1 -1
  28. data/examples/chart_styles.rb +1 -1
  29. data/examples/colors.rb +48 -1
  30. data/examples/comments2.rb +1 -1
  31. data/examples/conditional_format.rb +79 -1
  32. data/examples/data_validate.rb +8 -8
  33. data/examples/date_time.rb +1 -1
  34. data/examples/demo.rb +5 -8
  35. data/examples/formats.rb +1 -1
  36. data/examples/headers.rb +1 -1
  37. data/examples/hide_row_col.rb +1 -1
  38. data/examples/hide_sheet.rb +1 -1
  39. data/examples/hyperlink1.rb +5 -12
  40. data/examples/ignore_errors.rb +39 -0
  41. data/examples/indent.rb +1 -1
  42. data/examples/keep_leading_zeros.rb +17 -0
  43. data/examples/macros.rb +1 -1
  44. data/examples/merge1.rb +1 -1
  45. data/examples/merge2.rb +1 -1
  46. data/examples/merge3.rb +1 -1
  47. data/examples/merge4.rb +1 -1
  48. data/examples/merge5.rb +1 -1
  49. data/examples/merge6.rb +1 -1
  50. data/examples/outline.rb +1 -1
  51. data/examples/outline_collapsed.rb +1 -1
  52. data/examples/panes.rb +2 -2
  53. data/examples/properties.rb +1 -1
  54. data/examples/regions.rb +1 -1
  55. data/examples/rich_strings.rb +1 -1
  56. data/examples/right_to_left.rb +1 -1
  57. data/examples/shape1.rb +1 -1
  58. data/examples/shape2.rb +1 -1
  59. data/examples/shape3.rb +1 -1
  60. data/examples/shape4.rb +1 -1
  61. data/examples/shape5.rb +1 -1
  62. data/examples/shape6.rb +1 -1
  63. data/examples/shape7.rb +1 -1
  64. data/examples/shape8.rb +1 -1
  65. data/examples/shape_all.rb +1 -1
  66. data/examples/sparklines1.rb +1 -1
  67. data/examples/sparklines2.rb +1 -1
  68. data/examples/stats.rb +1 -1
  69. data/examples/stats_ext.rb +1 -1
  70. data/examples/stocks.rb +1 -1
  71. data/examples/tab_colors.rb +2 -2
  72. data/examples/tables.rb +78 -43
  73. data/examples/update_range_format_with_params.rb +33 -0
  74. data/lib/write_xlsx/chart/area.rb +1 -1
  75. data/lib/write_xlsx/chart/axis.rb +37 -12
  76. data/lib/write_xlsx/chart/bar.rb +1 -1
  77. data/lib/write_xlsx/chart/caption.rb +3 -1
  78. data/lib/write_xlsx/chart/column.rb +1 -1
  79. data/lib/write_xlsx/chart/doughnut.rb +1 -1
  80. data/lib/write_xlsx/chart/legend.rb +14 -0
  81. data/lib/write_xlsx/chart/line.rb +16 -2
  82. data/lib/write_xlsx/chart/pie.rb +32 -15
  83. data/lib/write_xlsx/chart/radar.rb +1 -1
  84. data/lib/write_xlsx/chart/scatter.rb +1 -16
  85. data/lib/write_xlsx/chart/series.rb +138 -18
  86. data/lib/write_xlsx/chart/stock.rb +1 -1
  87. data/lib/write_xlsx/chart.rb +365 -277
  88. data/lib/write_xlsx/chartsheet.rb +38 -10
  89. data/lib/write_xlsx/drawing.rb +190 -71
  90. data/lib/write_xlsx/format.rb +41 -201
  91. data/lib/write_xlsx/package/app.rb +17 -5
  92. data/lib/write_xlsx/package/button.rb +8 -8
  93. data/lib/write_xlsx/package/comments.rb +73 -68
  94. data/lib/write_xlsx/package/conditional_format.rb +367 -46
  95. data/lib/write_xlsx/package/content_types.rb +28 -9
  96. data/lib/write_xlsx/package/core.rb +13 -11
  97. data/lib/write_xlsx/package/custom.rb +125 -0
  98. data/lib/write_xlsx/package/metadata.rb +159 -0
  99. data/lib/write_xlsx/package/packager.rb +48 -0
  100. data/lib/write_xlsx/package/relationships.rb +4 -4
  101. data/lib/write_xlsx/package/shared_strings.rb +6 -6
  102. data/lib/write_xlsx/package/styles.rb +102 -39
  103. data/lib/write_xlsx/package/table.rb +83 -36
  104. data/lib/write_xlsx/package/theme.rb +1 -1
  105. data/lib/write_xlsx/package/vml.rb +63 -62
  106. data/lib/write_xlsx/package/xml_writer_simple.rb +3 -2
  107. data/lib/write_xlsx/shape.rb +21 -18
  108. data/lib/write_xlsx/sheets.rb +18 -16
  109. data/lib/write_xlsx/sparkline.rb +341 -341
  110. data/lib/write_xlsx/utility.rb +414 -53
  111. data/lib/write_xlsx/version.rb +1 -1
  112. data/lib/write_xlsx/workbook.rb +396 -699
  113. data/lib/write_xlsx/worksheet/cell_data.rb +46 -3
  114. data/lib/write_xlsx/worksheet/data_validation.rb +53 -50
  115. data/lib/write_xlsx/worksheet/hyperlink.rb +29 -50
  116. data/lib/write_xlsx/worksheet/page_setup.rb +12 -12
  117. data/lib/write_xlsx/worksheet.rb +1043 -4366
  118. data/test/chart/test_add_series.rb +11 -1
  119. data/test/chart/test_process_names.rb +1 -1
  120. data/test/chart/test_write_a_latin.rb +1 -1
  121. data/test/chart/test_write_auto.rb +1 -1
  122. data/test/chart/test_write_ax_id.rb +1 -1
  123. data/test/chart/test_write_ax_pos.rb +1 -1
  124. data/test/chart/test_write_cross_ax.rb +1 -1
  125. data/test/chart/test_write_crosses.rb +1 -1
  126. data/test/chart/test_write_d_lbls.rb +1 -1
  127. data/test/chart/test_write_format_code.rb +1 -1
  128. data/test/chart/test_write_idx.rb +1 -1
  129. data/test/chart/test_write_label_align.rb +1 -1
  130. data/test/chart/test_write_label_offset.rb +1 -1
  131. data/test/chart/test_write_lang.rb +1 -1
  132. data/test/chart/test_write_layout.rb +1 -1
  133. data/test/chart/test_write_legend.rb +1 -1
  134. data/test/chart/test_write_legend_pos.rb +10 -2
  135. data/test/chart/test_write_major_gridlines.rb +1 -1
  136. data/test/chart/test_write_marker.rb +1 -1
  137. data/test/chart/test_write_marker_size.rb +1 -1
  138. data/test/chart/test_write_marker_value.rb +1 -1
  139. data/test/chart/test_write_num_cache.rb +1 -1
  140. data/test/chart/test_write_number_format.rb +2 -3
  141. data/test/chart/test_write_order.rb +1 -1
  142. data/test/chart/test_write_orientation.rb +1 -1
  143. data/test/chart/test_write_page_margins.rb +1 -1
  144. data/test/chart/test_write_page_setup.rb +1 -1
  145. data/test/chart/test_write_plot_vis_only.rb +1 -1
  146. data/test/chart/test_write_pt.rb +1 -1
  147. data/test/chart/test_write_pt_count.rb +1 -1
  148. data/test/chart/test_write_series_formula.rb +1 -1
  149. data/test/chart/test_write_style.rb +1 -1
  150. data/test/chart/test_write_symbol.rb +1 -1
  151. data/test/chart/test_write_tick_lbl_pos.rb +1 -1
  152. data/test/chart/test_write_v.rb +1 -1
  153. data/test/chartsheet/test_chartsheet01.rb +1 -1
  154. data/test/chartsheet/test_write_sheet_protection.rb +91 -0
  155. data/test/drawing/test_drawing_chart_01.rb +7 -3
  156. data/test/drawing/test_drawing_image_01.rb +13 -4
  157. data/test/drawing/test_drawing_shape_01.rb +9 -6
  158. data/test/drawing/test_drawing_shape_02.rb +13 -6
  159. data/test/drawing/test_drawing_shape_03.rb +9 -6
  160. data/test/drawing/test_drawing_shape_04.rb +9 -25
  161. data/test/drawing/test_drawing_shape_05.rb +9 -6
  162. data/test/drawing/test_drawing_shape_06.rb +12 -7
  163. data/test/drawing/test_drawing_shape_07.rb +12 -7
  164. data/test/drawing/test_write_a_graphic_frame_locks.rb +2 -2
  165. data/test/drawing/test_write_c_chart.rb +2 -2
  166. data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +2 -2
  167. data/test/drawing/test_write_c_nv_pr.rb +2 -2
  168. data/test/drawing/test_write_col.rb +2 -2
  169. data/test/drawing/test_write_col_off.rb +2 -2
  170. data/test/drawing/test_write_pos.rb +2 -2
  171. data/test/drawing/test_write_row.rb +2 -2
  172. data/test/drawing/test_write_row_off.rb +2 -2
  173. data/test/drawing/{test_write_ext.rb → test_write_xdr_ext.rb} +3 -3
  174. data/test/drawing/test_write_xfrm_extension.rb +2 -2
  175. data/test/drawing/test_write_xfrm_offset.rb +2 -2
  176. data/test/helper.rb +8 -3
  177. data/test/package/app/test_app01.rb +1 -1
  178. data/test/package/app/test_app02.rb +1 -1
  179. data/test/package/app/test_app03.rb +1 -1
  180. data/test/package/comments/test_comments_01.rb +54 -0
  181. data/test/package/comments/test_comments_02.rb +54 -0
  182. data/test/package/content_types/test_content_types.rb +1 -1
  183. data/test/package/content_types/test_write_default.rb +1 -1
  184. data/test/package/content_types/test_write_override.rb +1 -1
  185. data/test/package/core/test_core01.rb +1 -1
  186. data/test/package/core/test_core02.rb +1 -1
  187. data/test/package/relationships/test_relationships.rb +1 -1
  188. data/test/package/relationships/test_sheet_rels.rb +1 -1
  189. data/test/package/shared_strings/test_shared_strings01.rb +1 -1
  190. data/test/package/shared_strings/test_shared_strings02.rb +1 -1
  191. data/test/package/shared_strings/test_write_si.rb +1 -7
  192. data/test/package/styles/test_styles_01.rb +1 -1
  193. data/test/package/styles/test_styles_02.rb +1 -1
  194. data/test/package/styles/test_styles_03.rb +1 -1
  195. data/test/package/styles/test_styles_04.rb +1 -1
  196. data/test/package/styles/test_styles_05.rb +1 -1
  197. data/test/package/styles/test_styles_06.rb +1 -1
  198. data/test/package/styles/test_styles_07.rb +1 -1
  199. data/test/package/styles/test_styles_08.rb +1 -1
  200. data/test/package/styles/test_styles_09.rb +1 -1
  201. data/test/package/table/test_table01.rb +3 -3
  202. data/test/package/table/test_table02.rb +2 -2
  203. data/test/package/table/test_table03.rb +2 -2
  204. data/test/package/table/test_table04.rb +2 -2
  205. data/test/package/table/test_table05.rb +2 -2
  206. data/test/package/table/test_table06.rb +2 -2
  207. data/test/package/table/test_table07.rb +2 -2
  208. data/test/package/table/test_table08.rb +2 -2
  209. data/test/package/table/test_table09.rb +2 -2
  210. data/test/package/table/test_table10.rb +2 -2
  211. data/test/package/table/test_table11.rb +2 -2
  212. data/test/package/table/test_table12.rb +2 -2
  213. data/test/package/table/test_table13.rb +1 -1
  214. data/test/package/table/test_write_auto_filter.rb +1 -1
  215. data/test/package/table/test_write_table_column.rb +1 -1
  216. data/test/package/table/test_write_table_style_info.rb +1 -1
  217. data/test/package/vml/test_write_auto_fill.rb +1 -1
  218. data/test/package/vml/test_write_div.rb +1 -1
  219. data/test/package/vml/test_write_idmap.rb +1 -1
  220. data/test/package/vml/test_write_path.rb +1 -1
  221. data/test/package/vml/test_write_shapelayout.rb +1 -1
  222. data/test/package/vml/test_write_shapetype.rb +1 -1
  223. data/test/package/vml/test_write_stroke.rb +1 -1
  224. data/test/perl_output/background.xlsx +0 -0
  225. data/test/perl_output/chart_data_labels.xlsx +0 -0
  226. data/test/perl_output/chart_gauge.xlsx +0 -0
  227. data/test/perl_output/chart_line.xlsx +0 -0
  228. data/test/perl_output/comments2.xlsx +0 -0
  229. data/test/perl_output/formats.xlsx +0 -0
  230. data/test/perl_output/ignore_errors.xlsx +0 -0
  231. data/test/perl_output/keep_leading_zeros.xlsx +0 -0
  232. data/test/perl_output/multi_line.xlsx +0 -0
  233. data/test/perl_output/tables.xlsx +0 -0
  234. data/test/regression/_test_hyperlink31.rb +26 -0
  235. data/test/regression/disabled_test_vml04.rb +1 -1
  236. data/test/regression/images/happy.jpg +0 -0
  237. data/test/regression/images/logo.gif +0 -0
  238. data/test/regression/images/logo.jpg +0 -0
  239. data/test/regression/images/red.gif +0 -0
  240. data/test/regression/images/red2.png +0 -0
  241. data/test/regression/images/red_208.png +0 -0
  242. data/test/regression/images/zero_dpi.jpg +0 -0
  243. data/test/regression/test_array_formula01.rb +1 -1
  244. data/test/regression/test_array_formula02.rb +1 -1
  245. data/test/regression/test_array_formula03.rb +36 -0
  246. data/test/regression/test_array_formula04.rb +31 -0
  247. data/test/regression/test_autofilter00.rb +1 -1
  248. data/test/regression/test_autofilter01.rb +1 -1
  249. data/test/regression/test_autofilter02.rb +1 -1
  250. data/test/regression/test_autofilter03.rb +1 -1
  251. data/test/regression/test_autofilter04.rb +1 -1
  252. data/test/regression/test_autofilter05.rb +1 -1
  253. data/test/regression/test_autofilter06.rb +1 -1
  254. data/test/regression/test_autofilter07.rb +1 -1
  255. data/test/regression/test_autofilter08.rb +110 -0
  256. data/test/regression/test_autofilter09.rb +110 -0
  257. data/test/regression/test_autofilter10.rb +110 -0
  258. data/test/regression/test_background01.rb +23 -0
  259. data/test/regression/test_background02.rb +23 -0
  260. data/test/regression/test_background03.rb +24 -0
  261. data/test/regression/test_background04.rb +25 -0
  262. data/test/regression/test_background05.rb +25 -0
  263. data/test/regression/test_background06.rb +31 -0
  264. data/test/regression/test_background07.rb +37 -0
  265. data/test/regression/test_button01.rb +1 -1
  266. data/test/regression/test_button02.rb +1 -1
  267. data/test/regression/test_button03.rb +1 -1
  268. data/test/regression/test_button04.rb +1 -1
  269. data/test/regression/test_button05.rb +1 -1
  270. data/test/regression/test_button06.rb +1 -1
  271. data/test/regression/test_button07.rb +1 -1
  272. data/test/regression/test_button08.rb +1 -1
  273. data/test/regression/test_button13.rb +1 -1
  274. data/test/regression/test_button14.rb +1 -1
  275. data/test/regression/test_chart_area01.rb +1 -1
  276. data/test/regression/test_chart_area02.rb +1 -1
  277. data/test/regression/test_chart_area03.rb +1 -1
  278. data/test/regression/test_chart_area04.rb +1 -1
  279. data/test/regression/test_chart_axis01.rb +1 -1
  280. data/test/regression/test_chart_axis02.rb +1 -1
  281. data/test/regression/test_chart_axis03.rb +1 -1
  282. data/test/regression/test_chart_axis04.rb +1 -1
  283. data/test/regression/test_chart_axis05.rb +1 -1
  284. data/test/regression/test_chart_axis06.rb +1 -1
  285. data/test/regression/test_chart_axis07.rb +1 -1
  286. data/test/regression/test_chart_axis08.rb +1 -1
  287. data/test/regression/test_chart_axis09.rb +1 -1
  288. data/test/regression/test_chart_axis10.rb +1 -1
  289. data/test/regression/test_chart_axis11.rb +1 -1
  290. data/test/regression/test_chart_axis12.rb +1 -1
  291. data/test/regression/test_chart_axis13.rb +1 -1
  292. data/test/regression/test_chart_axis14.rb +1 -1
  293. data/test/regression/test_chart_axis15.rb +1 -1
  294. data/test/regression/test_chart_axis16.rb +1 -1
  295. data/test/regression/test_chart_axis17.rb +1 -1
  296. data/test/regression/test_chart_axis18.rb +1 -1
  297. data/test/regression/test_chart_axis19.rb +1 -1
  298. data/test/regression/test_chart_axis20.rb +1 -1
  299. data/test/regression/test_chart_axis21.rb +1 -1
  300. data/test/regression/test_chart_axis22.rb +1 -1
  301. data/test/regression/test_chart_axis23.rb +1 -1
  302. data/test/regression/test_chart_axis24.rb +1 -1
  303. data/test/regression/test_chart_axis25.rb +1 -1
  304. data/test/regression/test_chart_axis26.rb +11 -9
  305. data/test/regression/test_chart_axis27.rb +2 -2
  306. data/test/regression/test_chart_axis28.rb +2 -2
  307. data/test/regression/test_chart_axis29.rb +2 -2
  308. data/test/regression/test_chart_axis30.rb +1 -1
  309. data/test/regression/test_chart_axis31.rb +1 -1
  310. data/test/regression/test_chart_axis32.rb +1 -1
  311. data/test/regression/test_chart_axis33.rb +2 -2
  312. data/test/regression/test_chart_axis34.rb +1 -1
  313. data/test/regression/test_chart_axis35.rb +1 -1
  314. data/test/regression/test_chart_axis36.rb +1 -1
  315. data/test/regression/test_chart_axis37.rb +1 -1
  316. data/test/regression/test_chart_axis38.rb +1 -1
  317. data/test/regression/test_chart_axis39.rb +1 -1
  318. data/test/regression/test_chart_axis40.rb +44 -0
  319. data/test/regression/test_chart_axis41.rb +48 -0
  320. data/test/regression/test_chart_axis42.rb +44 -0
  321. data/test/regression/test_chart_axis43.rb +44 -0
  322. data/test/regression/test_chart_axis44.rb +54 -0
  323. data/test/regression/test_chart_axis45.rb +54 -0
  324. data/test/regression/test_chart_axis46.rb +54 -0
  325. data/test/regression/test_chart_axis47.rb +52 -0
  326. data/test/regression/test_chart_axis48.rb +53 -0
  327. data/test/regression/test_chart_bar01.rb +1 -1
  328. data/test/regression/test_chart_bar02.rb +1 -1
  329. data/test/regression/test_chart_bar03.rb +1 -1
  330. data/test/regression/test_chart_bar04.rb +1 -1
  331. data/test/regression/test_chart_bar05.rb +1 -1
  332. data/test/regression/test_chart_bar06.rb +1 -1
  333. data/test/regression/test_chart_bar07.rb +1 -1
  334. data/test/regression/test_chart_bar08.rb +4 -1
  335. data/test/regression/test_chart_bar09.rb +1 -1
  336. data/test/regression/test_chart_bar10.rb +1 -1
  337. data/test/regression/test_chart_bar11.rb +4 -1
  338. data/test/regression/test_chart_bar12.rb +1 -1
  339. data/test/regression/test_chart_bar13.rb +1 -1
  340. data/test/regression/test_chart_bar14.rb +4 -1
  341. data/test/regression/test_chart_bar15.rb +1 -1
  342. data/test/regression/test_chart_bar16.rb +1 -1
  343. data/test/regression/test_chart_bar17.rb +1 -1
  344. data/test/regression/test_chart_bar18.rb +1 -1
  345. data/test/regression/test_chart_bar19.rb +1 -1
  346. data/test/regression/test_chart_bar20.rb +1 -1
  347. data/test/regression/test_chart_bar21.rb +1 -1
  348. data/test/regression/test_chart_bar22.rb +1 -1
  349. data/test/regression/test_chart_bar23.rb +1 -1
  350. data/test/regression/test_chart_bar24.rb +1 -1
  351. data/test/regression/test_chart_blank01.rb +1 -1
  352. data/test/regression/test_chart_blank02.rb +1 -1
  353. data/test/regression/test_chart_blank03.rb +1 -1
  354. data/test/regression/test_chart_blank04.rb +1 -1
  355. data/test/regression/test_chart_blank05.rb +1 -1
  356. data/test/regression/test_chart_blank06.rb +1 -1
  357. data/test/regression/test_chart_chartarea01.rb +1 -1
  358. data/test/regression/test_chart_chartarea02.rb +1 -1
  359. data/test/regression/test_chart_chartarea03.rb +1 -1
  360. data/test/regression/test_chart_chartarea04.rb +1 -1
  361. data/test/regression/test_chart_chartarea05.rb +17 -18
  362. data/test/regression/test_chart_chartarea06.rb +49 -0
  363. data/test/regression/test_chart_clustered01.rb +1 -1
  364. data/test/regression/test_chart_column01.rb +1 -1
  365. data/test/regression/test_chart_column02.rb +1 -1
  366. data/test/regression/test_chart_column03.rb +1 -1
  367. data/test/regression/test_chart_column04.rb +1 -1
  368. data/test/regression/test_chart_column05.rb +1 -1
  369. data/test/regression/test_chart_column06.rb +1 -1
  370. data/test/regression/test_chart_column07.rb +1 -1
  371. data/test/regression/test_chart_column08.rb +1 -1
  372. data/test/regression/test_chart_column09.rb +1 -1
  373. data/test/regression/test_chart_column10.rb +1 -1
  374. data/test/regression/test_chart_column11.rb +1 -1
  375. data/test/regression/test_chart_column12.rb +1 -1
  376. data/test/regression/test_chart_combined01.rb +1 -1
  377. data/test/regression/test_chart_combined02.rb +1 -1
  378. data/test/regression/test_chart_combined03.rb +1 -1
  379. data/test/regression/test_chart_combined04.rb +1 -1
  380. data/test/regression/test_chart_combined05.rb +1 -1
  381. data/test/regression/test_chart_combined06.rb +1 -1
  382. data/test/regression/test_chart_combined07.rb +1 -1
  383. data/test/regression/test_chart_combined08.rb +1 -1
  384. data/test/regression/test_chart_combined09.rb +50 -0
  385. data/test/regression/test_chart_combined10.rb +43 -0
  386. data/test/regression/test_chart_combined11.rb +63 -0
  387. data/test/regression/test_chart_crossing01.rb +2 -2
  388. data/test/regression/test_chart_crossing02.rb +1 -1
  389. data/test/regression/test_chart_crossing03.rb +1 -1
  390. data/test/regression/test_chart_crossing04.rb +1 -1
  391. data/test/regression/test_chart_crossing05.rb +46 -0
  392. data/test/regression/test_chart_crossing06.rb +46 -0
  393. data/test/regression/test_chart_data_labels01.rb +1 -1
  394. data/test/regression/test_chart_data_labels02.rb +1 -1
  395. data/test/regression/test_chart_data_labels03.rb +1 -1
  396. data/test/regression/test_chart_data_labels04.rb +1 -1
  397. data/test/regression/test_chart_data_labels05.rb +1 -1
  398. data/test/regression/test_chart_data_labels06.rb +1 -1
  399. data/test/regression/test_chart_data_labels07.rb +1 -1
  400. data/test/regression/test_chart_data_labels08.rb +1 -1
  401. data/test/regression/test_chart_data_labels09.rb +1 -1
  402. data/test/regression/test_chart_data_labels10.rb +1 -1
  403. data/test/regression/test_chart_data_labels11.rb +1 -1
  404. data/test/regression/test_chart_data_labels12.rb +1 -1
  405. data/test/regression/test_chart_data_labels13.rb +1 -1
  406. data/test/regression/test_chart_data_labels14.rb +1 -1
  407. data/test/regression/test_chart_data_labels15.rb +1 -1
  408. data/test/regression/test_chart_data_labels16.rb +1 -1
  409. data/test/regression/test_chart_data_labels17.rb +1 -1
  410. data/test/regression/test_chart_data_labels18.rb +1 -1
  411. data/test/regression/test_chart_data_labels19.rb +1 -1
  412. data/test/regression/test_chart_data_labels20.rb +1 -1
  413. data/test/regression/test_chart_data_labels21.rb +1 -1
  414. data/test/regression/test_chart_data_labels22.rb +1 -1
  415. data/test/regression/test_chart_data_labels23.rb +1 -1
  416. data/test/regression/test_chart_data_labels24.rb +1 -1
  417. data/test/regression/test_chart_data_labels25.rb +61 -0
  418. data/test/regression/test_chart_data_labels26.rb +44 -0
  419. data/test/regression/test_chart_data_labels27.rb +44 -0
  420. data/test/regression/test_chart_data_labels28.rb +52 -0
  421. data/test/regression/test_chart_data_labels29.rb +43 -0
  422. data/test/regression/test_chart_data_labels30.rb +46 -0
  423. data/test/regression/test_chart_data_labels31.rb +49 -0
  424. data/test/regression/test_chart_data_labels32.rb +54 -0
  425. data/test/regression/test_chart_data_labels33.rb +52 -0
  426. data/test/regression/test_chart_data_labels34.rb +54 -0
  427. data/test/regression/test_chart_data_labels35.rb +46 -0
  428. data/test/regression/test_chart_data_labels36.rb +54 -0
  429. data/test/regression/test_chart_data_labels37.rb +51 -0
  430. data/test/regression/test_chart_data_labels38.rb +54 -0
  431. data/test/regression/test_chart_data_labels39.rb +53 -0
  432. data/test/regression/test_chart_data_labels40.rb +53 -0
  433. data/test/regression/test_chart_data_labels41.rb +54 -0
  434. data/test/regression/test_chart_data_labels42.rb +58 -0
  435. data/test/regression/test_chart_data_labels43.rb +58 -0
  436. data/test/regression/test_chart_data_labels44.rb +56 -0
  437. data/test/regression/test_chart_data_labels45.rb +57 -0
  438. data/test/regression/test_chart_data_labels46.rb +61 -0
  439. data/test/regression/test_chart_data_labels47.rb +61 -0
  440. data/test/regression/test_chart_data_labels48.rb +55 -0
  441. data/test/regression/test_chart_data_labels49.rb +55 -0
  442. data/test/regression/test_chart_data_labels50.rb +57 -0
  443. data/test/regression/test_chart_date01.rb +1 -1
  444. data/test/regression/test_chart_date02.rb +1 -1
  445. data/test/regression/test_chart_date03.rb +1 -1
  446. data/test/regression/test_chart_date04.rb +1 -1
  447. data/test/regression/test_chart_date05.rb +1 -1
  448. data/test/regression/test_chart_display_units01.rb +1 -1
  449. data/test/regression/test_chart_display_units02.rb +1 -1
  450. data/test/regression/test_chart_display_units03.rb +1 -1
  451. data/test/regression/test_chart_display_units04.rb +1 -1
  452. data/test/regression/test_chart_display_units05.rb +1 -1
  453. data/test/regression/test_chart_display_units06.rb +1 -1
  454. data/test/regression/test_chart_display_units07.rb +1 -1
  455. data/test/regression/test_chart_display_units08.rb +1 -1
  456. data/test/regression/test_chart_display_units09.rb +1 -1
  457. data/test/regression/test_chart_display_units10.rb +1 -1
  458. data/test/regression/test_chart_display_units11.rb +1 -1
  459. data/test/regression/test_chart_display_units12.rb +1 -1
  460. data/test/regression/test_chart_doughnut01.rb +1 -1
  461. data/test/regression/test_chart_doughnut02.rb +1 -1
  462. data/test/regression/test_chart_doughnut03.rb +1 -1
  463. data/test/regression/test_chart_doughnut04.rb +1 -1
  464. data/test/regression/test_chart_doughnut05.rb +1 -1
  465. data/test/regression/test_chart_doughnut06.rb +1 -1
  466. data/test/regression/test_chart_doughnut07.rb +37 -0
  467. data/test/regression/test_chart_drop_lines01.rb +1 -1
  468. data/test/regression/test_chart_drop_lines02.rb +1 -1
  469. data/test/regression/test_chart_drop_lines03.rb +1 -1
  470. data/test/regression/test_chart_drop_lines04.rb +1 -1
  471. data/test/regression/test_chart_errorbars01.rb +1 -1
  472. data/test/regression/test_chart_errorbars02.rb +1 -1
  473. data/test/regression/test_chart_errorbars03.rb +1 -1
  474. data/test/regression/test_chart_errorbars04.rb +1 -1
  475. data/test/regression/test_chart_errorbars05.rb +1 -1
  476. data/test/regression/test_chart_errorbars06.rb +1 -1
  477. data/test/regression/test_chart_errorbars07.rb +1 -1
  478. data/test/regression/test_chart_errorbars08.rb +1 -1
  479. data/test/regression/test_chart_errorbars09.rb +1 -1
  480. data/test/regression/test_chart_errorbars10.rb +1 -1
  481. data/test/regression/test_chart_font01.rb +1 -1
  482. data/test/regression/test_chart_font02.rb +1 -1
  483. data/test/regression/test_chart_font03.rb +1 -1
  484. data/test/regression/test_chart_font04.rb +1 -1
  485. data/test/regression/test_chart_font05.rb +1 -1
  486. data/test/regression/test_chart_font06.rb +1 -1
  487. data/test/regression/test_chart_font07.rb +1 -1
  488. data/test/regression/test_chart_font08.rb +1 -1
  489. data/test/regression/test_chart_font09.rb +2 -2
  490. data/test/regression/test_chart_format01.rb +1 -1
  491. data/test/regression/test_chart_format02.rb +1 -1
  492. data/test/regression/test_chart_format03.rb +1 -1
  493. data/test/regression/test_chart_format04.rb +1 -1
  494. data/test/regression/test_chart_format05.rb +1 -1
  495. data/test/regression/test_chart_format06.rb +1 -1
  496. data/test/regression/test_chart_format07.rb +1 -1
  497. data/test/regression/test_chart_format08.rb +1 -1
  498. data/test/regression/test_chart_format09.rb +1 -1
  499. data/test/regression/test_chart_format10.rb +1 -1
  500. data/test/regression/test_chart_format11.rb +1 -1
  501. data/test/regression/test_chart_format12.rb +1 -1
  502. data/test/regression/test_chart_format13.rb +1 -1
  503. data/test/regression/test_chart_format14.rb +1 -1
  504. data/test/regression/test_chart_format15.rb +1 -1
  505. data/test/regression/test_chart_format16.rb +1 -1
  506. data/test/regression/test_chart_format17.rb +1 -1
  507. data/test/regression/test_chart_format18.rb +1 -1
  508. data/test/regression/test_chart_format19.rb +1 -1
  509. data/test/regression/test_chart_format20.rb +1 -1
  510. data/test/regression/test_chart_format21.rb +47 -0
  511. data/test/regression/test_chart_format22.rb +47 -0
  512. data/test/regression/test_chart_format23.rb +47 -0
  513. data/test/regression/test_chart_format24.rb +52 -0
  514. data/test/regression/test_chart_format25.rb +46 -0
  515. data/test/regression/test_chart_format26.rb +48 -0
  516. data/test/regression/test_chart_format27.rb +58 -0
  517. data/test/regression/test_chart_format28.rb +52 -0
  518. data/test/regression/test_chart_format29.rb +59 -0
  519. data/test/regression/test_chart_format30.rb +53 -0
  520. data/test/regression/test_chart_format31.rb +60 -0
  521. data/test/regression/test_chart_gap01.rb +1 -1
  522. data/test/regression/test_chart_gap02.rb +1 -1
  523. data/test/regression/test_chart_gap03.rb +1 -1
  524. data/test/regression/test_chart_gap04.rb +1 -1
  525. data/test/regression/test_chart_gap05.rb +1 -1
  526. data/test/regression/test_chart_gradient01.rb +1 -1
  527. data/test/regression/test_chart_gradient02.rb +1 -1
  528. data/test/regression/test_chart_gradient03.rb +1 -1
  529. data/test/regression/test_chart_gradient04.rb +1 -1
  530. data/test/regression/test_chart_gradient05.rb +1 -1
  531. data/test/regression/test_chart_gradient06.rb +1 -1
  532. data/test/regression/test_chart_gradient07.rb +1 -1
  533. data/test/regression/test_chart_gradient08.rb +1 -1
  534. data/test/regression/test_chart_gradient09.rb +1 -1
  535. data/test/regression/test_chart_gradient10.rb +1 -1
  536. data/test/regression/test_chart_gradient11.rb +1 -1
  537. data/test/regression/test_chart_gradient12.rb +1 -1
  538. data/test/regression/test_chart_gradient13.rb +1 -1
  539. data/test/regression/test_chart_gridlines01.rb +1 -1
  540. data/test/regression/test_chart_gridlines02.rb +1 -1
  541. data/test/regression/test_chart_gridlines03.rb +1 -1
  542. data/test/regression/test_chart_gridlines04.rb +5 -4
  543. data/test/regression/test_chart_gridlines05.rb +1 -1
  544. data/test/regression/test_chart_gridlines06.rb +1 -1
  545. data/test/regression/test_chart_gridlines07.rb +1 -1
  546. data/test/regression/test_chart_gridlines08.rb +9 -12
  547. data/test/regression/test_chart_gridlines09.rb +1 -1
  548. data/test/regression/test_chart_layout01.rb +1 -1
  549. data/test/regression/test_chart_layout02.rb +1 -1
  550. data/test/regression/test_chart_layout03.rb +1 -1
  551. data/test/regression/test_chart_layout04.rb +1 -1
  552. data/test/regression/test_chart_layout05.rb +1 -1
  553. data/test/regression/test_chart_layout06.rb +1 -1
  554. data/test/regression/test_chart_layout07.rb +1 -1
  555. data/test/regression/test_chart_layout08.rb +1 -1
  556. data/test/regression/test_chart_legend01.rb +1 -1
  557. data/test/regression/test_chart_legend02.rb +1 -1
  558. data/test/regression/test_chart_legend03.rb +41 -0
  559. data/test/regression/test_chart_legend04.rb +41 -0
  560. data/test/regression/test_chart_legend05.rb +41 -0
  561. data/test/regression/test_chart_legend06.rb +41 -0
  562. data/test/regression/test_chart_legend07.rb +38 -0
  563. data/test/regression/test_chart_line01.rb +1 -1
  564. data/test/regression/test_chart_line02.rb +1 -1
  565. data/test/regression/test_chart_line03.rb +1 -1
  566. data/test/regression/test_chart_line04.rb +1 -1
  567. data/test/regression/test_chart_line05.rb +43 -0
  568. data/test/regression/test_chart_line06.rb +43 -0
  569. data/test/regression/test_chart_name01.rb +1 -1
  570. data/test/regression/test_chart_name02.rb +1 -1
  571. data/test/regression/test_chart_name03.rb +1 -1
  572. data/test/regression/test_chart_order01.rb +1 -1
  573. data/test/regression/test_chart_order02.rb +1 -1
  574. data/test/regression/test_chart_order03.rb +1 -1
  575. data/test/regression/test_chart_pattern01.rb +49 -0
  576. data/test/regression/test_chart_pattern02.rb +106 -0
  577. data/test/regression/test_chart_pattern03.rb +105 -0
  578. data/test/regression/test_chart_pattern04.rb +105 -0
  579. data/test/regression/test_chart_pattern05.rb +105 -0
  580. data/test/regression/test_chart_pattern06.rb +105 -0
  581. data/test/regression/test_chart_pattern07.rb +105 -0
  582. data/test/regression/test_chart_pattern08.rb +105 -0
  583. data/test/regression/test_chart_pattern09.rb +57 -0
  584. data/test/regression/test_chart_pattern10.rb +57 -0
  585. data/test/regression/test_chart_pie01.rb +1 -1
  586. data/test/regression/test_chart_pie02.rb +1 -1
  587. data/test/regression/test_chart_pie03.rb +1 -1
  588. data/test/regression/test_chart_pie04.rb +1 -1
  589. data/test/regression/test_chart_pie05.rb +1 -1
  590. data/test/regression/test_chart_points01.rb +1 -1
  591. data/test/regression/test_chart_points02.rb +1 -1
  592. data/test/regression/test_chart_points03.rb +1 -1
  593. data/test/regression/test_chart_points04.rb +1 -1
  594. data/test/regression/test_chart_points05.rb +1 -1
  595. data/test/regression/test_chart_points06.rb +1 -1
  596. data/test/regression/test_chart_radar01.rb +1 -1
  597. data/test/regression/test_chart_radar02.rb +1 -1
  598. data/test/regression/test_chart_radar03.rb +1 -1
  599. data/test/regression/test_chart_scatter01.rb +1 -1
  600. data/test/regression/test_chart_scatter02.rb +1 -1
  601. data/test/regression/test_chart_scatter03.rb +1 -1
  602. data/test/regression/test_chart_scatter04.rb +1 -1
  603. data/test/regression/test_chart_scatter05.rb +1 -1
  604. data/test/regression/test_chart_scatter06.rb +1 -1
  605. data/test/regression/test_chart_scatter07.rb +1 -1
  606. data/test/regression/test_chart_scatter08.rb +1 -1
  607. data/test/regression/test_chart_scatter09.rb +1 -1
  608. data/test/regression/test_chart_scatter10.rb +1 -1
  609. data/test/regression/test_chart_scatter11.rb +1 -1
  610. data/test/regression/test_chart_scatter12.rb +1 -1
  611. data/test/regression/test_chart_scatter13.rb +1 -1
  612. data/test/regression/test_chart_scatter14.rb +1 -1
  613. data/test/regression/test_chart_scatter15.rb +1 -1
  614. data/test/regression/test_chart_size01.rb +1 -1
  615. data/test/regression/test_chart_size02.rb +1 -1
  616. data/test/regression/test_chart_size03.rb +5 -2
  617. data/test/regression/test_chart_size04.rb +1 -1
  618. data/test/regression/test_chart_size05.rb +1 -1
  619. data/test/regression/test_chart_sparse01.rb +1 -1
  620. data/test/regression/test_chart_stock01.rb +1 -1
  621. data/test/regression/test_chart_stock02.rb +1 -1
  622. data/test/regression/test_chart_str01.rb +1 -1
  623. data/test/regression/test_chart_str02.rb +1 -1
  624. data/test/regression/test_chart_table01.rb +1 -1
  625. data/test/regression/test_chart_table02.rb +1 -1
  626. data/test/regression/test_chart_table03.rb +56 -0
  627. data/test/regression/test_chart_title01.rb +1 -1
  628. data/test/regression/test_chart_title02.rb +1 -1
  629. data/test/regression/test_chartsheet01.rb +1 -1
  630. data/test/regression/test_chartsheet02.rb +1 -1
  631. data/test/regression/test_chartsheet03.rb +1 -1
  632. data/test/regression/test_chartsheet04.rb +1 -1
  633. data/test/regression/test_chartsheet05.rb +1 -1
  634. data/test/regression/test_chartsheet06.rb +1 -1
  635. data/test/regression/test_chartsheet07.rb +1 -1
  636. data/test/regression/test_chartsheet08.rb +1 -1
  637. data/test/regression/test_chartsheet09.rb +1 -1
  638. data/test/regression/test_comment01.rb +1 -1
  639. data/test/regression/test_comment02.rb +1 -1
  640. data/test/regression/test_comment03.rb +1 -1
  641. data/test/regression/test_comment04.rb +1 -1
  642. data/test/regression/test_comment06.rb +1 -1
  643. data/test/regression/test_comment07.rb +1 -1
  644. data/test/regression/test_comment08.rb +1 -1
  645. data/test/regression/test_comment09.rb +1 -1
  646. data/test/regression/test_comment10.rb +1 -1
  647. data/test/regression/test_comment11.rb +1 -1
  648. data/test/regression/test_comment12.rb +1 -1
  649. data/test/regression/test_comment13.rb +36 -0
  650. data/test/regression/test_comment14.rb +29 -0
  651. data/test/regression/test_comment15.rb +28 -0
  652. data/test/regression/test_comment16.rb +34 -0
  653. data/test/regression/test_cond_format01.rb +1 -1
  654. data/test/regression/test_cond_format02.rb +1 -1
  655. data/test/regression/test_cond_format03.rb +1 -1
  656. data/test/regression/test_cond_format04.rb +1 -1
  657. data/test/regression/test_cond_format05.rb +1 -1
  658. data/test/regression/test_cond_format06.rb +1 -1
  659. data/test/regression/test_cond_format07.rb +1 -1
  660. data/test/regression/test_cond_format08.rb +1 -1
  661. data/test/regression/test_cond_format10.rb +1 -1
  662. data/test/regression/test_cond_format11.rb +1 -1
  663. data/test/regression/test_cond_format12.rb +1 -1
  664. data/test/regression/test_cond_format13.rb +1 -1
  665. data/test/regression/test_cond_format14.rb +42 -0
  666. data/test/regression/test_cond_format15.rb +53 -0
  667. data/test/regression/test_cond_format16.rb +53 -0
  668. data/test/regression/test_cond_format17.rb +37 -0
  669. data/test/regression/test_cond_format18.rb +136 -0
  670. data/test/regression/test_cond_format19.rb +64 -0
  671. data/test/regression/test_cond_format20.rb +43 -0
  672. data/test/regression/test_custom_colors01.rb +1 -1
  673. data/test/regression/test_data_validation01.rb +1 -1
  674. data/test/regression/test_data_validation02.rb +1 -1
  675. data/test/regression/test_data_validation03.rb +1 -1
  676. data/test/regression/test_data_validation04.rb +2 -2
  677. data/test/regression/test_data_validation05.rb +2 -2
  678. data/test/regression/test_data_validation08.rb +24 -0
  679. data/test/regression/test_date_1904_01.rb +2 -2
  680. data/test/regression/test_date_1904_02.rb +1 -1
  681. data/test/regression/test_date_examples01.rb +1 -1
  682. data/test/regression/test_default_format01.rb +1 -1
  683. data/test/regression/test_default_row01.rb +1 -1
  684. data/test/regression/test_default_row02.rb +1 -1
  685. data/test/regression/test_default_row03.rb +1 -1
  686. data/test/regression/test_default_row04.rb +1 -1
  687. data/test/regression/test_default_row05.rb +32 -0
  688. data/test/regression/test_defined_name01.rb +1 -1
  689. data/test/regression/test_defined_name02.rb +1 -1
  690. data/test/regression/test_defined_name03.rb +1 -1
  691. data/test/regression/test_defined_name04.rb +15 -15
  692. data/test/regression/test_dynamic_array01.rb +25 -0
  693. data/test/regression/test_escapes01.rb +1 -1
  694. data/test/regression/test_escapes02.rb +1 -1
  695. data/test/regression/test_escapes03.rb +1 -1
  696. data/test/regression/test_escapes04.rb +4 -1
  697. data/test/regression/test_escapes05.rb +4 -1
  698. data/test/regression/test_escapes06.rb +1 -1
  699. data/test/regression/test_escapes07.rb +4 -1
  700. data/test/regression/test_escapes08.rb +4 -1
  701. data/test/regression/test_excel2003_style01.rb +1 -1
  702. data/test/regression/test_excel2003_style02.rb +1 -1
  703. data/test/regression/test_excel2003_style03.rb +1 -1
  704. data/test/regression/test_excel2003_style04.rb +1 -1
  705. data/test/regression/test_excel2003_style05.rb +1 -1
  706. data/test/regression/test_excel2003_style06.rb +1 -1
  707. data/test/regression/test_excel2003_style07.rb +1 -1
  708. data/test/regression/test_excel2003_style08.rb +1 -1
  709. data/test/regression/test_firstsheet01.rb +1 -1
  710. data/test/regression/test_fit_to_pages01.rb +1 -1
  711. data/test/regression/test_fit_to_pages02.rb +1 -1
  712. data/test/regression/test_fit_to_pages03.rb +1 -1
  713. data/test/regression/test_fit_to_pages04.rb +1 -1
  714. data/test/regression/test_fit_to_pages05.rb +1 -1
  715. data/test/regression/test_format01.rb +1 -1
  716. data/test/regression/test_format02.rb +1 -1
  717. data/test/regression/test_format03.rb +1 -1
  718. data/test/regression/test_format04.rb +1 -1
  719. data/test/regression/test_format05.rb +1 -1
  720. data/test/regression/test_format11.rb +1 -1
  721. data/test/regression/test_format12.rb +1 -1
  722. data/test/regression/test_format13.rb +31 -0
  723. data/test/regression/test_format14.rb +26 -0
  724. data/test/regression/test_format15.rb +26 -0
  725. data/test/regression/test_format16.rb +24 -0
  726. data/test/regression/test_format17.rb +24 -0
  727. data/test/regression/test_formula_results01.rb +1 -1
  728. data/test/regression/test_gridlines01.rb +1 -1
  729. data/test/regression/test_header01.rb +1 -1
  730. data/test/regression/test_header02.rb +1 -1
  731. data/test/regression/test_header03.rb +1 -1
  732. data/test/regression/test_header04.rb +30 -0
  733. data/test/regression/test_header_image01.rb +1 -1
  734. data/test/regression/test_header_image02.rb +1 -1
  735. data/test/regression/test_header_image03.rb +1 -1
  736. data/test/regression/test_header_image04.rb +1 -1
  737. data/test/regression/test_header_image05.rb +1 -1
  738. data/test/regression/test_header_image06.rb +1 -1
  739. data/test/regression/test_header_image07.rb +1 -1
  740. data/test/regression/test_header_image08.rb +1 -1
  741. data/test/regression/test_header_image09.rb +1 -1
  742. data/test/regression/test_header_image10.rb +1 -1
  743. data/test/regression/test_header_image11.rb +1 -1
  744. data/test/regression/test_header_image12.rb +1 -1
  745. data/test/regression/test_header_image13.rb +1 -1
  746. data/test/regression/test_header_image14.rb +1 -1
  747. data/test/regression/test_header_image15.rb +36 -0
  748. data/test/regression/test_header_image16.rb +42 -0
  749. data/test/regression/test_header_image17.rb +46 -0
  750. data/test/regression/test_header_image18.rb +48 -0
  751. data/test/regression/test_header_image19.rb +36 -0
  752. data/test/regression/test_hide01.rb +1 -1
  753. data/test/regression/test_hyperlink01.rb +4 -1
  754. data/test/regression/test_hyperlink02.rb +4 -1
  755. data/test/regression/test_hyperlink03.rb +5 -1
  756. data/test/regression/test_hyperlink04.rb +4 -1
  757. data/test/regression/test_hyperlink05.rb +4 -1
  758. data/test/regression/test_hyperlink06.rb +4 -1
  759. data/test/regression/test_hyperlink07.rb +4 -1
  760. data/test/regression/test_hyperlink08.rb +4 -1
  761. data/test/regression/test_hyperlink09.rb +4 -1
  762. data/test/regression/test_hyperlink10.rb +4 -1
  763. data/test/regression/test_hyperlink11.rb +4 -1
  764. data/test/regression/test_hyperlink12.rb +4 -1
  765. data/test/regression/test_hyperlink13.rb +4 -1
  766. data/test/regression/test_hyperlink14.rb +4 -1
  767. data/test/regression/test_hyperlink15.rb +4 -1
  768. data/test/regression/test_hyperlink16.rb +4 -1
  769. data/test/regression/test_hyperlink17.rb +4 -1
  770. data/test/regression/test_hyperlink18.rb +4 -1
  771. data/test/regression/test_hyperlink20.rb +4 -1
  772. data/test/regression/test_hyperlink21.rb +4 -1
  773. data/test/regression/test_hyperlink22.rb +27 -0
  774. data/test/regression/test_hyperlink23.rb +27 -0
  775. data/test/regression/test_hyperlink24.rb +27 -0
  776. data/test/regression/test_hyperlink25.rb +30 -0
  777. data/test/regression/test_hyperlink26.rb +30 -0
  778. data/test/regression/test_hyperlink27.rb +27 -0
  779. data/test/regression/test_hyperlink28.rb +50 -0
  780. data/test/regression/test_hyperlink29.rb +27 -0
  781. data/test/regression/test_hyperlink30.rb +36 -0
  782. data/test/regression/test_hyperlink32.rb +27 -0
  783. data/test/regression/test_hyperlink33.rb +28 -0
  784. data/test/regression/test_hyperlink34.rb +33 -0
  785. data/test/regression/test_hyperlink35.rb +39 -0
  786. data/test/regression/test_hyperlink36.rb +34 -0
  787. data/test/regression/test_hyperlink37.rb +33 -0
  788. data/test/regression/test_hyperlink38.rb +27 -0
  789. data/test/regression/test_hyperlink39.rb +27 -0
  790. data/test/regression/test_hyperlink40.rb +27 -0
  791. data/test/regression/test_hyperlink41.rb +27 -0
  792. data/test/regression/test_hyperlink42.rb +27 -0
  793. data/test/regression/test_hyperlink43.rb +27 -0
  794. data/test/regression/test_hyperlink44.rb +27 -0
  795. data/test/regression/test_hyperlink45.rb +27 -0
  796. data/test/regression/test_hyperlink47.rb +27 -0
  797. data/test/regression/test_hyperlink48.rb +31 -0
  798. data/test/regression/test_hyperlink49.rb +29 -0
  799. data/test/regression/test_hyperlink50.rb +27 -0
  800. data/test/regression/test_hyperlink51.rb +27 -0
  801. data/test/regression/test_ignore_error01.rb +23 -0
  802. data/test/regression/test_ignore_error02.rb +24 -0
  803. data/test/regression/test_ignore_error03.rb +26 -0
  804. data/test/regression/test_ignore_error04.rb +26 -0
  805. data/test/regression/test_ignore_error05.rb +32 -0
  806. data/test/regression/test_ignore_error06.rb +32 -0
  807. data/test/regression/test_image01.rb +1 -1
  808. data/test/regression/test_image02.rb +1 -1
  809. data/test/regression/test_image03.rb +1 -1
  810. data/test/regression/test_image04.rb +1 -1
  811. data/test/regression/test_image05.rb +1 -1
  812. data/test/regression/test_image06.rb +6 -6
  813. data/test/regression/test_image07.rb +1 -1
  814. data/test/regression/test_image08.rb +6 -5
  815. data/test/regression/test_image09.rb +1 -1
  816. data/test/regression/test_image10.rb +1 -1
  817. data/test/regression/test_image11.rb +1 -1
  818. data/test/regression/test_image12.rb +1 -1
  819. data/test/regression/test_image13.rb +1 -1
  820. data/test/regression/test_image14.rb +1 -1
  821. data/test/regression/test_image15.rb +5 -3
  822. data/test/regression/test_image16.rb +1 -1
  823. data/test/regression/test_image17.rb +1 -1
  824. data/test/regression/test_image18.rb +1 -1
  825. data/test/regression/test_image19.rb +1 -1
  826. data/test/regression/test_image22.rb +1 -1
  827. data/test/regression/test_image23.rb +1 -1
  828. data/test/regression/test_image24.rb +1 -1
  829. data/test/regression/test_image25.rb +1 -1
  830. data/test/regression/test_image26.rb +1 -1
  831. data/test/regression/test_image27.rb +1 -1
  832. data/test/regression/test_image28.rb +27 -0
  833. data/test/regression/test_image29.rb +27 -0
  834. data/test/regression/test_image30.rb +27 -0
  835. data/test/regression/test_image31.rb +30 -0
  836. data/test/regression/test_image32.rb +28 -0
  837. data/test/regression/test_image33.rb +32 -0
  838. data/test/regression/test_image35.rb +26 -0
  839. data/test/regression/test_image36.rb +26 -0
  840. data/test/regression/test_image44.rb +28 -0
  841. data/test/regression/test_image45.rb +29 -0
  842. data/test/regression/test_image46.rb +29 -0
  843. data/test/regression/test_image47.rb +28 -0
  844. data/test/regression/test_image48.rb +32 -0
  845. data/test/regression/test_image49.rb +38 -0
  846. data/test/regression/test_image50.rb +24 -0
  847. data/test/regression/test_image51.rb +30 -0
  848. data/test/regression/test_image52.rb +26 -0
  849. data/test/regression/test_image53.rb +26 -0
  850. data/test/regression/test_image54.rb +26 -0
  851. data/test/regression/test_image55.rb +27 -0
  852. data/test/regression/test_image56.rb +23 -0
  853. data/test/regression/test_image57.rb +23 -0
  854. data/test/regression/test_landscape01.rb +1 -1
  855. data/test/regression/test_macro01.rb +1 -1
  856. data/test/regression/test_merge_cells01.rb +1 -1
  857. data/test/regression/test_merge_range01.rb +1 -1
  858. data/test/regression/test_merge_range02.rb +1 -1
  859. data/test/regression/test_merge_range03.rb +1 -1
  860. data/test/regression/test_merge_range04.rb +1 -1
  861. data/test/regression/test_merge_range05.rb +1 -1
  862. data/test/regression/test_object_position01.rb +26 -0
  863. data/test/regression/test_object_position02.rb +26 -0
  864. data/test/regression/test_object_position03.rb +26 -0
  865. data/test/regression/test_object_position04.rb +44 -0
  866. data/test/regression/test_object_position06.rb +28 -0
  867. data/test/regression/test_object_position07.rb +28 -0
  868. data/test/regression/test_object_position08.rb +47 -0
  869. data/test/regression/test_object_position09.rb +50 -0
  870. data/test/regression/test_object_position10.rb +28 -0
  871. data/test/regression/test_object_position12.rb +25 -0
  872. data/test/regression/test_object_position13.rb +25 -0
  873. data/test/regression/test_object_position14.rb +25 -0
  874. data/test/regression/test_object_position15.rb +29 -0
  875. data/test/regression/test_object_position16.rb +29 -0
  876. data/test/regression/test_object_position17.rb +29 -0
  877. data/test/regression/test_object_position18.rb +29 -0
  878. data/test/regression/test_object_position19.rb +29 -0
  879. data/test/regression/test_object_position20.rb +29 -0
  880. data/test/regression/test_outline01.rb +1 -1
  881. data/test/regression/test_outline02.rb +1 -1
  882. data/test/regression/test_outline03.rb +1 -1
  883. data/test/regression/test_outline04.rb +1 -1
  884. data/test/regression/test_outline05.rb +1 -1
  885. data/test/regression/test_outline06.rb +1 -1
  886. data/test/regression/test_page_breaks01.rb +1 -1
  887. data/test/regression/test_page_breaks02.rb +1 -1
  888. data/test/regression/test_page_breaks03.rb +1 -1
  889. data/test/regression/test_page_breaks04.rb +1 -1
  890. data/test/regression/test_page_breaks05.rb +1 -1
  891. data/test/regression/test_page_breaks06.rb +1 -1
  892. data/test/regression/test_page_view01.rb +1 -1
  893. data/test/regression/test_panes01.rb +1 -1
  894. data/test/regression/test_print_across01.rb +1 -1
  895. data/test/regression/test_print_area01.rb +1 -1
  896. data/test/regression/test_print_area02.rb +1 -1
  897. data/test/regression/test_print_area03.rb +1 -1
  898. data/test/regression/test_print_area04.rb +1 -1
  899. data/test/regression/test_print_area05.rb +1 -1
  900. data/test/regression/test_print_area06.rb +1 -1
  901. data/test/regression/test_print_area07.rb +1 -1
  902. data/test/regression/test_print_options01.rb +1 -1
  903. data/test/regression/test_print_options02.rb +1 -1
  904. data/test/regression/test_print_options03.rb +1 -1
  905. data/test/regression/test_print_options04.rb +1 -1
  906. data/test/regression/test_print_options05.rb +1 -1
  907. data/test/regression/test_print_options06.rb +1 -1
  908. data/test/regression/test_print_options07.rb +1 -1
  909. data/test/regression/test_print_scale01.rb +1 -1
  910. data/test/regression/test_print_scale02.rb +1 -1
  911. data/test/regression/test_properties01.rb +2 -5
  912. data/test/regression/test_properties02.rb +25 -0
  913. data/test/regression/test_properties03.rb +26 -0
  914. data/test/regression/test_properties04.rb +61 -0
  915. data/test/regression/test_properties05.rb +30 -0
  916. data/test/regression/test_protect01.rb +1 -1
  917. data/test/regression/test_protect02.rb +1 -1
  918. data/test/regression/test_protect03.rb +1 -1
  919. data/test/regression/test_protect04.rb +32 -0
  920. data/test/regression/test_protect05.rb +35 -0
  921. data/test/regression/test_protect06.rb +35 -0
  922. data/test/regression/test_protect07.rb +23 -0
  923. data/test/regression/test_quote_name01.rb +1 -1
  924. data/test/regression/test_quote_name03.rb +1 -1
  925. data/test/regression/test_quote_name04.rb +1 -1
  926. data/test/regression/test_repeat01.rb +1 -1
  927. data/test/regression/test_repeat02.rb +1 -1
  928. data/test/regression/test_repeat03.rb +1 -1
  929. data/test/regression/test_repeat04.rb +1 -1
  930. data/test/regression/test_repeat05.rb +1 -1
  931. data/test/regression/test_rich_string01.rb +1 -1
  932. data/test/regression/test_rich_string02.rb +1 -1
  933. data/test/regression/test_rich_string03.rb +1 -1
  934. data/test/regression/test_rich_string04.rb +1 -1
  935. data/test/regression/test_rich_string05.rb +1 -1
  936. data/test/regression/test_rich_string06.rb +1 -1
  937. data/test/regression/test_rich_string07.rb +1 -1
  938. data/test/regression/test_rich_string08.rb +1 -1
  939. data/test/regression/test_rich_string09.rb +1 -1
  940. data/test/regression/test_rich_string10.rb +1 -1
  941. data/test/regression/test_rich_string11.rb +1 -1
  942. data/test/regression/test_rich_string12.rb +1 -1
  943. data/test/regression/test_row_col_format01.rb +1 -1
  944. data/test/regression/test_row_col_format02.rb +1 -1
  945. data/test/regression/test_row_col_format03.rb +1 -1
  946. data/test/regression/test_row_col_format04.rb +1 -1
  947. data/test/regression/test_row_col_format05.rb +1 -1
  948. data/test/regression/test_row_col_format06.rb +1 -1
  949. data/test/regression/test_row_col_format07.rb +1 -1
  950. data/test/regression/test_row_col_format08.rb +1 -1
  951. data/test/regression/test_row_col_format09.rb +1 -1
  952. data/test/regression/test_row_col_format10.rb +1 -1
  953. data/test/regression/test_row_col_format11.rb +1 -1
  954. data/test/regression/test_row_col_format12.rb +1 -1
  955. data/test/regression/test_row_col_format13.rb +1 -1
  956. data/test/regression/test_row_col_format14.rb +1 -1
  957. data/test/regression/test_selection01.rb +1 -1
  958. data/test/regression/test_selection02.rb +1 -1
  959. data/test/regression/test_set_column01.rb +1 -1
  960. data/test/regression/test_set_column02.rb +1 -1
  961. data/test/regression/test_set_column03.rb +1 -1
  962. data/test/regression/test_set_column04.rb +1 -1
  963. data/test/regression/test_set_column05.rb +1 -1
  964. data/test/regression/test_set_column06.rb +1 -1
  965. data/test/regression/test_set_column07.rb +1 -1
  966. data/test/regression/test_set_column08.rb +1 -1
  967. data/test/regression/test_set_column09.rb +1 -1
  968. data/test/regression/test_set_column10.rb +55 -0
  969. data/test/regression/test_set_column11.rb +48 -0
  970. data/test/regression/test_set_print_scale01.rb +1 -1
  971. data/test/regression/test_set_row01.rb +35 -0
  972. data/test/regression/test_set_row02.rb +35 -0
  973. data/test/regression/test_set_row03.rb +35 -0
  974. data/test/regression/test_set_row04.rb +35 -0
  975. data/test/regression/test_set_start_page01.rb +1 -1
  976. data/test/regression/test_set_start_page02.rb +1 -1
  977. data/test/regression/test_set_start_page03.rb +1 -1
  978. data/test/regression/test_shape01.rb +1 -1
  979. data/test/regression/test_shape02.rb +1 -1
  980. data/test/regression/test_shape03.rb +1 -1
  981. data/test/regression/test_shape04.rb +1 -1
  982. data/test/regression/test_shape_connect01.rb +5 -3
  983. data/test/regression/test_shape_connect02.rb +1 -1
  984. data/test/regression/test_shape_connect03.rb +1 -1
  985. data/test/regression/test_shape_connect04.rb +1 -1
  986. data/test/regression/test_shape_scale01.rb +1 -1
  987. data/test/regression/test_shape_stencil01.rb +1 -1
  988. data/test/regression/test_shared_strings01.rb +1 -1
  989. data/test/regression/test_shared_strings02.rb +1 -1
  990. data/test/regression/test_simple01.rb +1 -1
  991. data/test/regression/test_simple02.rb +1 -1
  992. data/test/regression/test_simple03.rb +1 -1
  993. data/test/regression/test_simple04.rb +1 -1
  994. data/test/regression/test_simple05.rb +1 -1
  995. data/test/regression/test_tab_color01.rb +1 -1
  996. data/test/regression/test_table01.rb +1 -1
  997. data/test/regression/test_table02.rb +1 -1
  998. data/test/regression/test_table03.rb +4 -1
  999. data/test/regression/test_table04.rb +4 -1
  1000. data/test/regression/test_table05.rb +4 -1
  1001. data/test/regression/test_table06.rb +4 -1
  1002. data/test/regression/test_table07.rb +1 -1
  1003. data/test/regression/test_table08.rb +1 -1
  1004. data/test/regression/test_table09.rb +1 -1
  1005. data/test/regression/test_table10.rb +1 -1
  1006. data/test/regression/test_table11.rb +1 -1
  1007. data/test/regression/test_table12.rb +1 -1
  1008. data/test/regression/test_table13.rb +1 -1
  1009. data/test/regression/test_table14.rb +1 -1
  1010. data/test/regression/test_table15.rb +1 -1
  1011. data/test/regression/test_table16.rb +1 -1
  1012. data/test/regression/test_table17.rb +1 -1
  1013. data/test/regression/test_table20.rb +34 -0
  1014. data/test/regression/test_table21.rb +36 -0
  1015. data/test/regression/test_table22.rb +32 -0
  1016. data/test/regression/test_table23.rb +56 -0
  1017. data/test/regression/test_table24.rb +27 -0
  1018. data/test/regression/test_table25.rb +27 -0
  1019. data/test/regression/test_table26.rb +38 -0
  1020. data/test/regression/test_tutorial01.rb +1 -1
  1021. data/test/regression/test_tutorial02.rb +1 -1
  1022. data/test/regression/test_tutorial03.rb +1 -1
  1023. data/test/regression/test_types02.rb +25 -0
  1024. data/test/regression/test_types08.rb +31 -0
  1025. data/test/regression/test_update_range_format_with_params.rb +42 -0
  1026. data/test/regression/test_urls_as_strings.rb +1 -1
  1027. data/test/regression/test_utf8_01.rb +1 -1
  1028. data/test/regression/test_utf8_03.rb +1 -1
  1029. data/test/regression/test_utf8_04.rb +1 -1
  1030. data/test/regression/test_utf8_05.rb +1 -1
  1031. data/test/regression/test_utf8_06.rb +1 -1
  1032. data/test/regression/test_utf8_07.rb +1 -1
  1033. data/test/regression/test_utf8_08.rb +1 -1
  1034. data/test/regression/test_utf8_09.rb +1 -1
  1035. data/test/regression/test_utf8_10.rb +1 -1
  1036. data/test/regression/test_utf8_11.rb +23 -0
  1037. data/test/regression/test_vml01.rb +1 -1
  1038. data/test/regression/test_vml02.rb +1 -1
  1039. data/test/regression/test_vml03.rb +1 -1
  1040. data/test/regression/xlsx_files/array_formula03.xlsx +0 -0
  1041. data/test/regression/xlsx_files/array_formula04.xlsx +0 -0
  1042. data/test/regression/xlsx_files/autofilter08.xlsx +0 -0
  1043. data/test/regression/xlsx_files/autofilter09.xlsx +0 -0
  1044. data/test/regression/xlsx_files/autofilter10.xlsx +0 -0
  1045. data/test/regression/xlsx_files/background01.xlsx +0 -0
  1046. data/test/regression/xlsx_files/background02.xlsx +0 -0
  1047. data/test/regression/xlsx_files/background03.xlsx +0 -0
  1048. data/test/regression/xlsx_files/background04.xlsx +0 -0
  1049. data/test/regression/xlsx_files/background05.xlsx +0 -0
  1050. data/test/regression/xlsx_files/background06.xlsx +0 -0
  1051. data/test/regression/xlsx_files/background07.xlsx +0 -0
  1052. data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
  1053. data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
  1054. data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
  1055. data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
  1056. data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
  1057. data/test/regression/xlsx_files/chart_axis40.xlsx +0 -0
  1058. data/test/regression/xlsx_files/chart_axis41.xlsx +0 -0
  1059. data/test/regression/xlsx_files/chart_axis42.xlsx +0 -0
  1060. data/test/regression/xlsx_files/chart_axis43.xlsx +0 -0
  1061. data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
  1062. data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
  1063. data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
  1064. data/test/regression/xlsx_files/chart_axis47.xlsx +0 -0
  1065. data/test/regression/xlsx_files/chart_axis48.xlsx +0 -0
  1066. data/test/regression/xlsx_files/chart_chartarea05.xlsx +0 -0
  1067. data/test/regression/xlsx_files/chart_chartarea06.xlsx +0 -0
  1068. data/test/regression/xlsx_files/chart_combined09.xlsx +0 -0
  1069. data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
  1070. data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
  1071. data/test/regression/xlsx_files/chart_crossing05.xlsx +0 -0
  1072. data/test/regression/xlsx_files/chart_crossing06.xlsx +0 -0
  1073. data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
  1074. data/test/regression/xlsx_files/chart_data_labels26.xlsx +0 -0
  1075. data/test/regression/xlsx_files/chart_data_labels27.xlsx +0 -0
  1076. data/test/regression/xlsx_files/chart_data_labels28.xlsx +0 -0
  1077. data/test/regression/xlsx_files/chart_data_labels29.xlsx +0 -0
  1078. data/test/regression/xlsx_files/chart_data_labels30.xlsx +0 -0
  1079. data/test/regression/xlsx_files/chart_data_labels31.xlsx +0 -0
  1080. data/test/regression/xlsx_files/chart_data_labels32.xlsx +0 -0
  1081. data/test/regression/xlsx_files/chart_data_labels33.xlsx +0 -0
  1082. data/test/regression/xlsx_files/chart_data_labels34.xlsx +0 -0
  1083. data/test/regression/xlsx_files/chart_data_labels35.xlsx +0 -0
  1084. data/test/regression/xlsx_files/chart_data_labels36.xlsx +0 -0
  1085. data/test/regression/xlsx_files/chart_data_labels37.xlsx +0 -0
  1086. data/test/regression/xlsx_files/chart_data_labels38.xlsx +0 -0
  1087. data/test/regression/xlsx_files/chart_data_labels39.xlsx +0 -0
  1088. data/test/regression/xlsx_files/chart_data_labels40.xlsx +0 -0
  1089. data/test/regression/xlsx_files/chart_data_labels41.xlsx +0 -0
  1090. data/test/regression/xlsx_files/chart_data_labels42.xlsx +0 -0
  1091. data/test/regression/xlsx_files/chart_data_labels43.xlsx +0 -0
  1092. data/test/regression/xlsx_files/chart_data_labels44.xlsx +0 -0
  1093. data/test/regression/xlsx_files/chart_data_labels45.xlsx +0 -0
  1094. data/test/regression/xlsx_files/chart_data_labels46.xlsx +0 -0
  1095. data/test/regression/xlsx_files/chart_data_labels47.xlsx +0 -0
  1096. data/test/regression/xlsx_files/chart_data_labels48.xlsx +0 -0
  1097. data/test/regression/xlsx_files/chart_data_labels49.xlsx +0 -0
  1098. data/test/regression/xlsx_files/chart_data_labels50.xlsx +0 -0
  1099. data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
  1100. data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
  1101. data/test/regression/xlsx_files/chart_format21.xlsx +0 -0
  1102. data/test/regression/xlsx_files/chart_format22.xlsx +0 -0
  1103. data/test/regression/xlsx_files/chart_format23.xlsx +0 -0
  1104. data/test/regression/xlsx_files/chart_format24.xlsx +0 -0
  1105. data/test/regression/xlsx_files/chart_format25.xlsx +0 -0
  1106. data/test/regression/xlsx_files/chart_format26.xlsx +0 -0
  1107. data/test/regression/xlsx_files/chart_format27.xlsx +0 -0
  1108. data/test/regression/xlsx_files/chart_format28.xlsx +0 -0
  1109. data/test/regression/xlsx_files/chart_format29.xlsx +0 -0
  1110. data/test/regression/xlsx_files/chart_format30.xlsx +0 -0
  1111. data/test/regression/xlsx_files/chart_format31.xlsx +0 -0
  1112. data/test/regression/xlsx_files/chart_legend03.xlsx +0 -0
  1113. data/test/regression/xlsx_files/chart_legend04.xlsx +0 -0
  1114. data/test/regression/xlsx_files/chart_legend05.xlsx +0 -0
  1115. data/test/regression/xlsx_files/chart_legend06.xlsx +0 -0
  1116. data/test/regression/xlsx_files/chart_legend07.xlsx +0 -0
  1117. data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
  1118. data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
  1119. data/test/regression/xlsx_files/chart_pattern01.xlsx +0 -0
  1120. data/test/regression/xlsx_files/chart_pattern02.xlsx +0 -0
  1121. data/test/regression/xlsx_files/chart_pattern03.xlsx +0 -0
  1122. data/test/regression/xlsx_files/chart_pattern04.xlsx +0 -0
  1123. data/test/regression/xlsx_files/chart_pattern05.xlsx +0 -0
  1124. data/test/regression/xlsx_files/chart_pattern06.xlsx +0 -0
  1125. data/test/regression/xlsx_files/chart_pattern07.xlsx +0 -0
  1126. data/test/regression/xlsx_files/chart_pattern08.xlsx +0 -0
  1127. data/test/regression/xlsx_files/chart_pattern09.xlsx +0 -0
  1128. data/test/regression/xlsx_files/chart_pattern10.xlsx +0 -0
  1129. data/test/regression/xlsx_files/chart_table03.xlsx +0 -0
  1130. data/test/regression/xlsx_files/comment13.xlsx +0 -0
  1131. data/test/regression/xlsx_files/comment14.xlsx +0 -0
  1132. data/test/regression/xlsx_files/comment15.xlsx +0 -0
  1133. data/test/regression/xlsx_files/comment16.xlsx +0 -0
  1134. data/test/regression/xlsx_files/cond_format14.xlsx +0 -0
  1135. data/test/regression/xlsx_files/cond_format15.xlsx +0 -0
  1136. data/test/regression/xlsx_files/cond_format16.xlsx +0 -0
  1137. data/test/regression/xlsx_files/cond_format17.xlsx +0 -0
  1138. data/test/regression/xlsx_files/cond_format18.xlsx +0 -0
  1139. data/test/regression/xlsx_files/cond_format19.xlsx +0 -0
  1140. data/test/regression/xlsx_files/cond_format20.xlsx +0 -0
  1141. data/test/regression/xlsx_files/data_validation08.xlsx +0 -0
  1142. data/test/regression/xlsx_files/date_1904_01.xlsx +0 -0
  1143. data/test/regression/xlsx_files/default_row05.xlsx +0 -0
  1144. data/test/regression/xlsx_files/dynamic_array01.xlsx +0 -0
  1145. data/test/regression/xlsx_files/format13.xlsx +0 -0
  1146. data/test/regression/xlsx_files/format14.xlsx +0 -0
  1147. data/test/regression/xlsx_files/format15.xlsx +0 -0
  1148. data/test/regression/xlsx_files/format16.xlsx +0 -0
  1149. data/test/regression/xlsx_files/format17.xlsx +0 -0
  1150. data/test/regression/xlsx_files/header04.xlsx +0 -0
  1151. data/test/regression/xlsx_files/header_image15.xlsx +0 -0
  1152. data/test/regression/xlsx_files/header_image16.xlsx +0 -0
  1153. data/test/regression/xlsx_files/header_image17.xlsx +0 -0
  1154. data/test/regression/xlsx_files/header_image18.xlsx +0 -0
  1155. data/test/regression/xlsx_files/header_image19.xlsx +0 -0
  1156. data/test/regression/xlsx_files/hyperlink22.xlsx +0 -0
  1157. data/test/regression/xlsx_files/hyperlink23.xlsx +0 -0
  1158. data/test/regression/xlsx_files/hyperlink24.xlsx +0 -0
  1159. data/test/regression/xlsx_files/hyperlink25.xlsx +0 -0
  1160. data/test/regression/xlsx_files/hyperlink26.xlsx +0 -0
  1161. data/test/regression/xlsx_files/hyperlink27.xlsx +0 -0
  1162. data/test/regression/xlsx_files/hyperlink28.xlsx +0 -0
  1163. data/test/regression/xlsx_files/hyperlink29.xlsx +0 -0
  1164. data/test/regression/xlsx_files/hyperlink30.xlsx +0 -0
  1165. data/test/regression/xlsx_files/hyperlink31.xlsx +0 -0
  1166. data/test/regression/xlsx_files/hyperlink32.xlsx +0 -0
  1167. data/test/regression/xlsx_files/hyperlink33.xlsx +0 -0
  1168. data/test/regression/xlsx_files/hyperlink34.xlsx +0 -0
  1169. data/test/regression/xlsx_files/hyperlink35.xlsx +0 -0
  1170. data/test/regression/xlsx_files/hyperlink36.xlsx +0 -0
  1171. data/test/regression/xlsx_files/hyperlink37.xlsx +0 -0
  1172. data/test/regression/xlsx_files/hyperlink38.xlsx +0 -0
  1173. data/test/regression/xlsx_files/hyperlink39.xlsx +0 -0
  1174. data/test/regression/xlsx_files/hyperlink40.xlsx +0 -0
  1175. data/test/regression/xlsx_files/hyperlink41.xlsx +0 -0
  1176. data/test/regression/xlsx_files/hyperlink42.xlsx +0 -0
  1177. data/test/regression/xlsx_files/hyperlink43.xlsx +0 -0
  1178. data/test/regression/xlsx_files/hyperlink44.xlsx +0 -0
  1179. data/test/regression/xlsx_files/hyperlink45.xlsx +0 -0
  1180. data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
  1181. data/test/regression/xlsx_files/hyperlink47.xlsx +0 -0
  1182. data/test/regression/xlsx_files/hyperlink48.xlsx +0 -0
  1183. data/test/regression/xlsx_files/hyperlink49.xlsx +0 -0
  1184. data/test/regression/xlsx_files/hyperlink50.xlsx +0 -0
  1185. data/test/regression/xlsx_files/hyperlink51.xlsx +0 -0
  1186. data/test/regression/xlsx_files/ignore_error01.xlsx +0 -0
  1187. data/test/regression/xlsx_files/ignore_error02.xlsx +0 -0
  1188. data/test/regression/xlsx_files/ignore_error03.xlsx +0 -0
  1189. data/test/regression/xlsx_files/ignore_error04.xlsx +0 -0
  1190. data/test/regression/xlsx_files/ignore_error05.xlsx +0 -0
  1191. data/test/regression/xlsx_files/ignore_error06.xlsx +0 -0
  1192. data/test/regression/xlsx_files/image06.xlsx +0 -0
  1193. data/test/regression/xlsx_files/image28.xlsx +0 -0
  1194. data/test/regression/xlsx_files/image29.xlsx +0 -0
  1195. data/test/regression/xlsx_files/image30.xlsx +0 -0
  1196. data/test/regression/xlsx_files/image31.xlsx +0 -0
  1197. data/test/regression/xlsx_files/image32.xlsx +0 -0
  1198. data/test/regression/xlsx_files/image33.xlsx +0 -0
  1199. data/test/regression/xlsx_files/image35.xlsx +0 -0
  1200. data/test/regression/xlsx_files/image36.xlsx +0 -0
  1201. data/test/regression/xlsx_files/image44.xlsx +0 -0
  1202. data/test/regression/xlsx_files/image45.xlsx +0 -0
  1203. data/test/regression/xlsx_files/image46.xlsx +0 -0
  1204. data/test/regression/xlsx_files/image47.xlsx +0 -0
  1205. data/test/regression/xlsx_files/image48.xlsx +0 -0
  1206. data/test/regression/xlsx_files/image49.xlsx +0 -0
  1207. data/test/regression/xlsx_files/image50.xlsx +0 -0
  1208. data/test/regression/xlsx_files/image51.xlsx +0 -0
  1209. data/test/regression/xlsx_files/image52.xlsx +0 -0
  1210. data/test/regression/xlsx_files/image53.xlsx +0 -0
  1211. data/test/regression/xlsx_files/image54.xlsx +0 -0
  1212. data/test/regression/xlsx_files/image55.xlsx +0 -0
  1213. data/test/regression/xlsx_files/image56.xlsx +0 -0
  1214. data/test/regression/xlsx_files/image57.xlsx +0 -0
  1215. data/test/regression/xlsx_files/object_position01.xlsx +0 -0
  1216. data/test/regression/xlsx_files/object_position02.xlsx +0 -0
  1217. data/test/regression/xlsx_files/object_position03.xlsx +0 -0
  1218. data/test/regression/xlsx_files/object_position04.xlsx +0 -0
  1219. data/test/regression/xlsx_files/object_position06.xlsx +0 -0
  1220. data/test/regression/xlsx_files/object_position07.xlsx +0 -0
  1221. data/test/regression/xlsx_files/object_position08.xlsx +0 -0
  1222. data/test/regression/xlsx_files/object_position09.xlsx +0 -0
  1223. data/test/regression/xlsx_files/object_position10.xlsx +0 -0
  1224. data/test/regression/xlsx_files/object_position12.xlsx +0 -0
  1225. data/test/regression/xlsx_files/object_position13.xlsx +0 -0
  1226. data/test/regression/xlsx_files/object_position14.xlsx +0 -0
  1227. data/test/regression/xlsx_files/object_position15.xlsx +0 -0
  1228. data/test/regression/xlsx_files/object_position16.xlsx +0 -0
  1229. data/test/regression/xlsx_files/object_position17.xlsx +0 -0
  1230. data/test/regression/xlsx_files/object_position18.xlsx +0 -0
  1231. data/test/regression/xlsx_files/object_position19.xlsx +0 -0
  1232. data/test/regression/xlsx_files/object_position20.xlsx +0 -0
  1233. data/test/regression/xlsx_files/properties02.xlsx +0 -0
  1234. data/test/regression/xlsx_files/properties03.xlsx +0 -0
  1235. data/test/regression/xlsx_files/properties04.xlsx +0 -0
  1236. data/test/regression/xlsx_files/properties05.xlsx +0 -0
  1237. data/test/regression/xlsx_files/protect04.xlsx +0 -0
  1238. data/test/regression/xlsx_files/protect05.xlsx +0 -0
  1239. data/test/regression/xlsx_files/protect06.xlsx +0 -0
  1240. data/test/regression/xlsx_files/protect07.xlsx +0 -0
  1241. data/test/regression/xlsx_files/set_row01.xlsx +0 -0
  1242. data/test/regression/xlsx_files/set_row03.xlsx +0 -0
  1243. data/test/regression/xlsx_files/table18.xlsx +0 -0
  1244. data/test/regression/xlsx_files/table19.xlsx +0 -0
  1245. data/test/regression/xlsx_files/table21.xlsx +0 -0
  1246. data/test/regression/xlsx_files/table22.xlsx +0 -0
  1247. data/test/regression/xlsx_files/table23.xlsx +0 -0
  1248. data/test/regression/xlsx_files/table24.xlsx +0 -0
  1249. data/test/regression/xlsx_files/table25.xlsx +0 -0
  1250. data/test/regression/xlsx_files/table26.xlsx +0 -0
  1251. data/test/regression/xlsx_files/types02.xlsx +0 -0
  1252. data/test/regression/xlsx_files/types08.xlsx +0 -0
  1253. data/test/regression/xlsx_files/update_range_format_with_params.xlsx +0 -0
  1254. data/test/regression/xlsx_files/utf8_11.xlsx +0 -0
  1255. data/test/test_delete_files.rb +3 -3
  1256. data/test/test_example_match.rb +1342 -781
  1257. data/test/test_option_hash_for_workbook.rb +1 -1
  1258. data/test/test_xml_writer_simple.rb +1 -1
  1259. data/test/utility/test_range.rb +20 -0
  1260. data/test/workbook/test_check_sheetname.rb +51 -0
  1261. data/test/workbook/test_define_name.rb +1 -1
  1262. data/test/workbook/test_get_chart_range.rb +3 -5
  1263. data/test/workbook/test_sort_defined_names.rb +1 -1
  1264. data/test/workbook/test_workbook_01.rb +1 -1
  1265. data/test/workbook/test_workbook_02.rb +1 -1
  1266. data/test/workbook/test_workbook_03.rb +1 -1
  1267. data/test/workbook/test_worksheet_by_name.rb +35 -0
  1268. data/test/workbook/test_write_calc_pr.rb +1 -1
  1269. data/test/workbook/test_write_defined_name.rb +1 -1
  1270. data/test/workbook/test_write_defined_names.rb +1 -1
  1271. data/test/workbook/test_write_workbook_view.rb +117 -0
  1272. data/test/worksheet/test_calculate_spans.rb +1 -1
  1273. data/test/worksheet/test_cond_format_01.rb +1 -1
  1274. data/test/worksheet/test_cond_format_02.rb +1 -1
  1275. data/test/worksheet/test_cond_format_03.rb +1 -1
  1276. data/test/worksheet/test_cond_format_04.rb +1 -1
  1277. data/test/worksheet/test_cond_format_05.rb +1 -1
  1278. data/test/worksheet/test_cond_format_06.rb +1 -1
  1279. data/test/worksheet/test_cond_format_07.rb +1 -1
  1280. data/test/worksheet/test_cond_format_08.rb +1 -1
  1281. data/test/worksheet/test_cond_format_09.rb +1 -1
  1282. data/test/worksheet/test_cond_format_10.rb +1 -1
  1283. data/test/worksheet/test_cond_format_11.rb +1 -1
  1284. data/test/worksheet/test_cond_format_12.rb +1 -1
  1285. data/test/worksheet/test_cond_format_13.rb +1 -1
  1286. data/test/worksheet/test_cond_format_14.rb +1 -1
  1287. data/test/worksheet/test_cond_format_15.rb +1 -1
  1288. data/test/worksheet/test_cond_format_16.rb +1 -1
  1289. data/test/worksheet/test_cond_format_17.rb +1 -1
  1290. data/test/worksheet/test_cond_format_18.rb +1 -1
  1291. data/test/worksheet/test_cond_format_19.rb +1 -1
  1292. data/test/worksheet/test_cond_format_20.rb +1 -1
  1293. data/test/worksheet/test_cond_format_21.rb +90 -0
  1294. data/test/worksheet/test_cond_format_22.rb +266 -0
  1295. data/test/worksheet/test_cond_format_23.rb +242 -0
  1296. data/test/worksheet/test_cond_format_24.rb +303 -0
  1297. data/test/worksheet/test_convert_date_time_01.rb +1 -1
  1298. data/test/worksheet/test_convert_date_time_02.rb +1 -1
  1299. data/test/worksheet/test_convert_date_time_03.rb +1 -1
  1300. data/test/worksheet/test_convert_date_time_04.rb +1 -1
  1301. data/test/worksheet/test_data_bar_01.rb +53 -0
  1302. data/test/worksheet/test_data_bar_02.rb +79 -0
  1303. data/test/worksheet/test_data_bar_03.rb +147 -0
  1304. data/test/worksheet/test_data_bar_04.rb +145 -0
  1305. data/test/worksheet/test_data_bar_05.rb +147 -0
  1306. data/test/worksheet/test_data_bar_06.rb +145 -0
  1307. data/test/worksheet/test_data_bar_07.rb +146 -0
  1308. data/test/worksheet/test_data_bar_08.rb +54 -0
  1309. data/test/worksheet/test_data_bar_09.rb +80 -0
  1310. data/test/worksheet/test_data_bar_10.rb +165 -0
  1311. data/test/worksheet/test_data_bar_11.rb +167 -0
  1312. data/test/worksheet/test_data_bar_12.rb +104 -0
  1313. data/test/worksheet/test_extract_filter_tokens.rb +1 -1
  1314. data/test/worksheet/test_parse_filter_expression.rb +1 -1
  1315. data/test/worksheet/test_pixels_to_row_col.rb +46 -0
  1316. data/test/worksheet/test_position_object.rb +1 -1
  1317. data/test/worksheet/test_repeat_formula.rb +1 -1
  1318. data/test/worksheet/test_sparkline_01.rb +1 -1
  1319. data/test/worksheet/test_sparkline_02.rb +1 -1
  1320. data/test/worksheet/test_sparkline_03.rb +1 -1
  1321. data/test/worksheet/test_sparkline_04.rb +1 -1
  1322. data/test/worksheet/test_sparkline_05.rb +1 -1
  1323. data/test/worksheet/test_sparkline_06.rb +1 -1
  1324. data/test/worksheet/test_sparkline_07.rb +1 -1
  1325. data/test/worksheet/test_sparkline_08.rb +1 -1
  1326. data/test/worksheet/test_sparkline_09.rb +1 -1
  1327. data/test/worksheet/test_sparkline_10.rb +1 -1
  1328. data/test/worksheet/test_sparkline_11.rb +1 -1
  1329. data/test/worksheet/test_sparkline_12.rb +94 -0
  1330. data/test/worksheet/test_update_format_methods.rb +91 -0
  1331. data/test/worksheet/test_worksheet_01.rb +1 -1
  1332. data/test/worksheet/test_worksheet_02.rb +1 -1
  1333. data/test/worksheet/test_worksheet_03.rb +1 -1
  1334. data/test/worksheet/test_worksheet_04.rb +1 -1
  1335. data/test/worksheet/test_write_array_formula_01.rb +1 -8
  1336. data/test/worksheet/test_write_autofilter.rb +1 -1
  1337. data/test/worksheet/test_write_brk.rb +1 -1
  1338. data/test/worksheet/test_write_cell.rb +1 -1
  1339. data/test/worksheet/test_write_cell_value.rb +1 -1
  1340. data/test/worksheet/test_write_col_breaks.rb +1 -1
  1341. data/test/worksheet/test_write_col_info.rb +1 -1
  1342. data/test/worksheet/test_write_conditional_formatting.rb +1 -1
  1343. data/test/worksheet/test_write_custom_filter.rb +1 -1
  1344. data/test/worksheet/test_write_custom_filters.rb +1 -1
  1345. data/test/worksheet/test_write_data_validation_01.rb +1 -1
  1346. data/test/worksheet/test_write_data_validation_02.rb +59 -2
  1347. data/test/worksheet/test_write_dimension.rb +1 -1
  1348. data/test/worksheet/test_write_filter.rb +1 -1
  1349. data/test/worksheet/test_write_filter_column.rb +1 -1
  1350. data/test/worksheet/test_write_filters.rb +1 -1
  1351. data/test/worksheet/test_write_formula_does_not_change_formula_string.rb +1 -1
  1352. data/test/worksheet/test_write_header_footer.rb +1 -1
  1353. data/test/worksheet/test_write_hyperlink.rb +1 -8
  1354. data/test/worksheet/test_write_legacy_drawing.rb +1 -1
  1355. data/test/worksheet/test_write_merge_cell.rb +1 -1
  1356. data/test/worksheet/test_write_merge_cells.rb +1 -1
  1357. data/test/worksheet/test_write_methods.rb +68 -177
  1358. data/test/worksheet/test_write_page_margins.rb +1 -1
  1359. data/test/worksheet/test_write_page_set_up_pr.rb +1 -1
  1360. data/test/worksheet/test_write_page_setup.rb +1 -1
  1361. data/test/worksheet/test_write_pane.rb +1 -1
  1362. data/test/worksheet/test_write_phonetic_pr.rb +1 -1
  1363. data/test/worksheet/test_write_print_options.rb +1 -1
  1364. data/test/worksheet/test_write_row_breaks.rb +1 -1
  1365. data/test/worksheet/test_write_row_element.rb +1 -1
  1366. data/test/worksheet/test_write_selection.rb +1 -1
  1367. data/test/worksheet/test_write_sheet_calc_pr.rb +1 -1
  1368. data/test/worksheet/test_write_sheet_data.rb +1 -1
  1369. data/test/worksheet/test_write_sheet_format_pr.rb +1 -1
  1370. data/test/worksheet/test_write_sheet_pr.rb +1 -1
  1371. data/test/worksheet/test_write_sheet_protection.rb +1 -1
  1372. data/test/worksheet/test_write_sheet_view.rb +20 -2
  1373. data/test/worksheet/test_write_sheet_view1.rb +1 -1
  1374. data/test/worksheet/test_write_sheet_view2.rb +1 -1
  1375. data/test/worksheet/test_write_sheet_view3.rb +1 -1
  1376. data/test/worksheet/test_write_sheet_view4.rb +1 -1
  1377. data/test/worksheet/test_write_sheet_view5.rb +1 -1
  1378. data/test/worksheet/test_write_sheet_view6.rb +1 -1
  1379. data/test/worksheet/test_write_sheet_view7.rb +1 -1
  1380. data/test/worksheet/test_write_sheet_view8.rb +1 -1
  1381. data/test/worksheet/test_write_sheet_view9.rb +1 -1
  1382. data/test/worksheet/test_write_tab_color.rb +1 -1
  1383. data/test/worksheet/test_write_worksheet_attributes.rb +1 -1
  1384. data/write_xlsx.gemspec +4 -3
  1385. metadata +937 -18
  1386. data/test/package/comments/test_write_text_t.rb +0 -44
  1387. data/test/test_col_name.rb +0 -13
  1388. data/test/workbook/test_workbook_new.rb +0 -18
  1389. data/test/worksheet/test_write_multiline_string_with_url.rb +0 -30
  1390. data/test/worksheet/test_write_url.rb +0 -19
@@ -19,77 +19,25 @@ module Writexlsx
19
19
 
20
20
  OFFICE_URL = 'http://schemas.microsoft.com/office/' # :nodoc:
21
21
 
22
- # The WriteXLSX provides an object oriented interface to a new Excel workbook.
23
- # The following methods are available through a new workbook.
24
- #
25
- # * new[#method-c-new]
26
- # * add_worksheet[#method-i-add_worksheet]
27
- # * add_format[#method-i-add_format]
28
- # * add_chart[#method-i-add_chart]
29
- # * add_shape[#method-i-add_shape]
30
- # * add_vba_project[#method-i-add_vba_project]
31
- # * close[#method-i-close]
32
- # * set_properties[#method-i-set_properties]
33
- # * define_name[#method-i-define_name]
34
- # * set_custom_color[#method-i-set_custom_color]
35
- # * sheets[#method-i-sheets]
36
- # * set_1904[#method-i-set_1904]
37
- #
38
22
  class Workbook
39
23
 
40
24
  include Writexlsx::Utility
41
25
 
42
- attr_writer :firstsheet # :nodoc:
43
- attr_reader :palette # :nodoc:
44
- attr_reader :worksheets, :charts, :drawings # :nodoc:
45
- attr_reader :named_ranges # :nodoc:
46
- attr_reader :doc_properties # :nodoc:
47
- attr_reader :image_types, :images # :nodoc:
48
- attr_reader :shared_strings # :nodoc:
49
- attr_reader :vba_project # :nodoc:
50
- attr_reader :excel2003_style # :nodoc:
51
- attr_reader :strings_to_urls # :nodoc:
52
- #
53
- # A new Excel workbook is created using the +new+ constructor
54
- # which accepts either a filename or an IO object as a parameter.
55
- # The following example creates a new Excel file based on a filename:
56
- #
57
- # workbook = WriteXLSX.new('filename.xlsx')
58
- # worksheet = workbook.add_worksheet
59
- # worksheet.write(0, 0, 'Hi Excel!')
60
- # workbook.close
61
- #
62
- # Here are some other examples of using +new+ with filenames:
63
- #
64
- # workbook1 = WriteXLSX.new(filename)
65
- # workbook2 = WriteXLSX.new('/tmp/filename.xlsx')
66
- # workbook3 = WriteXLSX.new("c:\\tmp\\filename.xlsx")
67
- # workbook4 = WriteXLSX.new('c:\tmp\filename.xlsx')
68
- #
69
- # The last two examples demonstrates how to create a file on DOS or Windows
70
- # where it is necessary to either escape the directory separator \
71
- # or to use single quotes to ensure that it isn't interpolated.
72
- #
73
- # It is recommended that the filename uses the extension .xlsx
74
- # rather than .xls since the latter causes an Excel warning
75
- # when used with the XLSX format.
76
- #
77
- # The +new+ constructor returns a WriteXLSX object that you can use to
78
- # add worksheets and store data.
79
- #
80
- # You can also pass a valid IO object to the +new+ constructor.
81
- #
82
- # xlsx = StringIO.new
83
- # workbook = WriteXLSX.new(xlsx)
84
- # ....
85
- # workbook.close
86
- # # you can get XLSX binary data as xlsx.string
87
- #
88
- # And you can pass default_formats parameter like this:
89
- #
90
- # formats = { :font => 'Arial', :size => 10.5 }
91
- # workbook = WriteXLSX.new('file.xlsx', formats)
92
- #
26
+ attr_writer :firstsheet # :nodoc:
27
+ attr_reader :palette # :nodoc:
28
+ attr_reader :worksheets, :charts, :drawings # :nodoc:
29
+ attr_reader :named_ranges # :nodoc:
30
+ attr_reader :doc_properties # :nodoc:
31
+ attr_reader :custom_properties # :nodoc:
32
+ attr_reader :image_types, :images # :nodoc:
33
+ attr_reader :shared_strings # :nodoc:
34
+ attr_reader :vba_project # :nodoc:
35
+ attr_reader :excel2003_style # :nodoc:
36
+ attr_reader :max_url_length # :nodoc:
37
+ attr_reader :strings_to_urls # :nodoc:
38
+ attr_reader :default_url_format # :nodoc:
39
+ attr_reader :read_only # :nodoc:
40
+
93
41
  def initialize(file, *option_params)
94
42
  options, default_formats = process_workbook_options(*option_params)
95
43
  @writer = Package::XMLWriterSimple.new
@@ -114,19 +62,28 @@ module Writexlsx
114
62
  @named_ranges = []
115
63
  @custom_colors = []
116
64
  @doc_properties = {}
117
- @local_time = Time.now
65
+ @custom_properties = []
118
66
  @optimization = options[:optimization] || 0
119
67
  @x_window = 240
120
68
  @y_window = 15
121
69
  @window_width = 16095
122
70
  @window_height = 9660
123
- @tab_ratio = 500
71
+ @tab_ratio = 600
124
72
  @excel2003_style = options[:excel2003_style] || false
125
73
  @table_count = 0
126
74
  @image_types = {}
127
75
  @images = []
128
76
  @strings_to_urls = (options[:strings_to_urls].nil? || options[:strings_to_urls]) ? true : false
129
77
 
78
+ @max_url_length = 2079
79
+ @has_comments = false
80
+ @read_only = 0
81
+ @has_metadata = false
82
+ if options[:max_url_length]
83
+ @max_url_length = options[:max_url_length]
84
+
85
+ @max_url_length = 2079 if @max_url_length < 250
86
+ end
130
87
  # Structures for the shared strings data.
131
88
  @shared_strings = Package::SharedStrings.new
132
89
 
@@ -136,24 +93,26 @@ module Writexlsx
136
93
  @calc_on_load = true
137
94
 
138
95
  if @excel2003_style
139
- add_format(default_formats
140
- .merge(:xf_index => 0, :font_family => 0, :font => 'Arial', :size => 10, :theme => -1))
96
+ add_format(default_formats.merge(
97
+ :xf_index => 0,
98
+ :font_family => 0,
99
+ :font => 'Arial',
100
+ :size => 10,
101
+ :theme => -1
102
+ ))
141
103
  else
142
104
  add_format(default_formats.merge(:xf_index => 0))
143
105
  end
106
+
107
+ # Add a default URL format.
108
+ @default_url_format = add_format(:hyperlink => 1)
109
+
144
110
  set_color_palette
145
111
  end
146
112
 
147
113
  #
148
114
  # The close method is used to close an Excel file.
149
115
  #
150
- # An explicit close is required if the file must be closed prior to performing
151
- # some external action on it such as copying it, reading its size or attaching
152
- # it to an email.
153
- #
154
- # In general, if you create a file with a size of 0 bytes or you fail to create
155
- # a file you need to call close.
156
- #
157
116
  def close
158
117
  # In case close() is called twice.
159
118
  return if @fileclosed
@@ -169,32 +128,6 @@ module Writexlsx
169
128
  # sheets -> array of all Wordsheet object
170
129
  # sheets(1, 3, 4) -> array of spcified Worksheet object.
171
130
  #
172
- # The sheets method returns a array, or a sliced array, of the worksheets
173
- # in a workbook.
174
- #
175
- # If no arguments are passed the method returns a list of all the worksheets
176
- # in the workbook. This is useful if you want to repeat an operation on each
177
- # worksheet:
178
- #
179
- # workbook.sheets.each do |worksheet|
180
- # print worksheet.get_name
181
- # end
182
- #
183
- # You can also specify a slice list to return one or more worksheet objects:
184
- #
185
- # worksheet = workbook.sheets(0)
186
- # worksheet.write('A1', 'Hello')
187
- #
188
- # you can write the above example as:
189
- #
190
- # workbook.sheets(0).write('A1', 'Hello')
191
- #
192
- # The following example returns the first and last worksheet in a workbook:
193
- #
194
- # workbook.sheets(0, -1).each do |sheet|
195
- # # Do something
196
- # end
197
- #
198
131
  def sheets(*args)
199
132
  if args.empty?
200
133
  @worksheets
@@ -204,21 +137,15 @@ module Writexlsx
204
137
  end
205
138
 
206
139
  #
207
- # Set the date system: false = 1900 (the default), true = 1904
208
- #
209
- # Excel stores dates as real numbers where the integer part stores
210
- # the number of days since the epoch and the fractional part stores
211
- # the percentage of the day. The epoch can be either 1900 or 1904.
212
- # Excel for Windows uses 1900 and Excel for Macintosh uses 1904.
213
- # However, Excel on either platform will convert automatically between
214
- # one system and the other.
140
+ # Return a worksheet object in the workbook using the sheetname.
215
141
  #
216
- # WriteXLSX stores dates in the 1900 format by default. If you wish to
217
- # change this you can call the set_1904 workbook method.
218
- # You can query the current value by calling the get_1904 workbook method.
219
- # This returns false for 1900 and true for 1904.
142
+ def worksheet_by_name(sheetname = nil)
143
+ sheets.select { |s| s.name == sheetname }.first
144
+ end
145
+ alias get_worksheet_by_name worksheet_by_name
146
+
220
147
  #
221
- # In general you probably won't need to use set_1904.
148
+ # Set the date system: false = 1900 (the default), true = 1904
222
149
  #
223
150
  def set_1904(mode = true)
224
151
  unless sheets.empty?
@@ -269,6 +196,9 @@ module Writexlsx
269
196
  # Write the XLSX file version.
270
197
  write_file_version
271
198
 
199
+ # Write the fileSharing element.
200
+ write_file_sharing
201
+
272
202
  # Write the workbook properties.
273
203
  write_workbook_pr
274
204
 
@@ -293,20 +223,6 @@ module Writexlsx
293
223
  #
294
224
  # At least one worksheet should be added to a new workbook. A worksheet is used to write data into cells:
295
225
  #
296
- # worksheet1 = workbook.add_worksheet # Sheet1
297
- # worksheet2 = workbook.add_worksheet('Foglio2') # Foglio2
298
- # worksheet3 = workbook.add_worksheet('Data') # Data
299
- # worksheet4 = workbook.add_worksheet # Sheet4
300
- # If name is not specified the default Excel convention will be followed, i.e. Sheet1, Sheet2, etc.
301
- #
302
- # The worksheet name must be a valid Excel worksheet name,
303
- # i.e. it cannot contain any of the following characters,
304
- # [ ] : * ? / \
305
- #
306
- # and it must be less than 32 characters.
307
- # In addition, you cannot use the same, case insensitive,
308
- # sheetname for more than one worksheet.
309
- #
310
226
  def add_worksheet(name = '')
311
227
  name = check_sheetname(name)
312
228
  worksheet = Worksheet.new(self, @worksheets.size, name)
@@ -317,72 +233,7 @@ module Writexlsx
317
233
  #
318
234
  # This method is use to create a new chart either as a standalone worksheet
319
235
  # (the default) or as an embeddable object that can be inserted into
320
- # a worksheet via the
321
- # {Worksheet#insert_chart}[Worksheet.html#method-i-insert_chart] method.
322
- #
323
- # chart = workbook.add_chart(:type => 'column')
324
- #
325
- # The properties that can be set are:
326
- #
327
- # :type (required)
328
- # :subtype (optional)
329
- # :name (optional)
330
- # :embedded (optional)
331
- #
332
- # === :type
333
- #
334
- # This is a required parameter.
335
- # It defines the type of chart that will be created.
336
- #
337
- # chart = workbook.add_chart(:type => 'line')
338
- #
339
- # The available types are:
340
- #
341
- # area
342
- # bar
343
- # column
344
- # line
345
- # pie
346
- # scatter
347
- # stock
348
- #
349
- # === :subtype
350
- #
351
- # Used to define a chart subtype where available.
352
- #
353
- # chart = workbook.add_chart(:type => 'bar', :subtype => 'stacked')
354
- #
355
- # Currently only Bar and Column charts support subtypes
356
- # (stacked and percent_stacked). See the documentation for those chart
357
- # types.
358
- #
359
- # === :name
360
- #
361
- # Set the name for the chart sheet. The name property is optional and
362
- # if it isn't supplied will default to Chart1 .. n. The name must be
363
- # a valid Excel worksheet name. See add_worksheet
364
- # for more details on valid sheet names. The name property can be
365
- # omitted for embedded charts.
366
- #
367
- # chart = workbook.add_chart(:type => 'line', :name => 'Results Chart')
368
- #
369
- # === :embedded
370
- #
371
- # Specifies that the Chart object will be inserted in a worksheet
372
- # via the {Worksheet#insert_chart}[Worksheet.html#insert_chart] method.
373
- # It is an error to try insert a Chart that doesn't have this flag set.
374
- #
375
- # chart = workbook.add_chart(:type => 'line', :embedded => 1)
376
- #
377
- # # Configure the chart.
378
- # ...
379
- #
380
- # # Insert the chart into the a worksheet.
381
- # worksheet.insert_chart('E2', chart)
382
- #
383
- # See Chart[Chart.html] for details on how to configure the chart object
384
- # once it is created. See also the chart_*.rb programs in the examples
385
- # directory of the distro.
236
+ # a worksheet via the insert_chart method.
386
237
  #
387
238
  def add_chart(params = {})
388
239
  # Type must be specified so we can create the required chart instance.
@@ -414,7 +265,7 @@ module Writexlsx
414
265
  end
415
266
 
416
267
  #
417
- # The +add_format+ method can be used to create new Format objects
268
+ # The add_format method can be used to create new Format objects
418
269
  # which are used to apply formatting to a cell. You can either define
419
270
  # the properties at creation time via a hash of property values
420
271
  # or later via method calls.
@@ -422,9 +273,6 @@ module Writexlsx
422
273
  # format1 = workbook.add_format(property_hash) # Set properties at creation
423
274
  # format2 = workbook.add_format # Set properties later
424
275
  #
425
- # See the {Format Class's rdoc}[Format.html] for more details about
426
- # Format properties and how to set them.
427
- #
428
276
  def add_format(property_hash = {})
429
277
  properties = {}
430
278
  if @excel2003_style
@@ -443,236 +291,6 @@ module Writexlsx
443
291
  # The +add_shape+ method can be used to create new shapes that may be
444
292
  # inserted into a worksheet.
445
293
  #
446
- # You can either define the properties at creation time via a hash of
447
- # property values or later via method calls.
448
- #
449
- # # Set properties at creation.
450
- # plus = workbook.add_shape(
451
- # :type => 'plus',
452
- # :id => 3,
453
- # :width => pw,
454
- # :height => ph
455
- # )
456
- #
457
- # # Default rectangle shape. Set properties later.
458
- # rect = workbook.add_shape
459
- #
460
- # See also the shape*.rb programs in the examples directory of the distro.
461
- #
462
- # === Shape Properties
463
- #
464
- # Any shape property can be queried or modified by [ ] like hash.
465
- #
466
- # ellipse = workbook.add_shape(properties)
467
- # ellipse[:type] = 'cross' # No longer an ellipse !
468
- # type = ellipse[:type] # Find out what it really is.
469
- #
470
- # The properties of a shape object that can be defined via add_shape are
471
- # shown below.
472
- #
473
- # ===:name
474
- #
475
- # Defines the name of the shape. This is an optional property and the shape
476
- # will be given a default name if not supplied. The name is generally only
477
- # used by Excel Macros to refer to the object.
478
- #
479
- # ===:type
480
- #
481
- # Defines the type of the object such as +:rect+, +:ellipse+ OR +:triangle+.
482
- #
483
- # ellipse = workbook.add_shape(:type => :ellipse)
484
- #
485
- # The default type is +:rect+.
486
- #
487
- # The full list of available shapes is shown below.
488
- #
489
- # See also the shape_all.rb program in the examples directory of the distro.
490
- # It creates an example workbook with all supported shapes labelled with
491
- # their shape names.
492
- #
493
- # === Basic Shapes
494
- #
495
- # blockArc can chevron cube decagon
496
- # diamond dodecagon donut ellipse funnel
497
- # gear6 gear9 heart heptagon hexagon
498
- # homePlate lightningBolt line lineInv moon
499
- # nonIsoscelesTrapezoid noSmoking octagon parallelogram pentagon
500
- # pie pieWedge plaque rect round1Rect
501
- # round2DiagRect round2SameRect roundRect rtTriangle smileyFace
502
- # snip1Rect snip2DiagRect snip2SameRect snipRoundRect star10
503
- # star12 star16 star24 star32 star4
504
- # star5 star6 star7 star8 sun
505
- # teardrop trapezoid triangle
506
- #
507
- # === Arrow Shapes
508
- #
509
- # bentArrow bentUpArrow circularArrow curvedDownArrow
510
- # curvedLeftArrow curvedRightArrow curvedUpArrow downArrow
511
- # leftArrow leftCircularArrow leftRightArrow leftRightCircularArrow
512
- # leftRightUpArrow leftUpArrow notchedRightArrow quadArrow
513
- # rightArrow stripedRightArrow swooshArrow upArrow
514
- # upDownArrow uturnArrow
515
- #
516
- # === Connector Shapes
517
- #
518
- # bentConnector2 bentConnector3 bentConnector4
519
- # bentConnector5 curvedConnector2 curvedConnector3
520
- # curvedConnector4 curvedConnector5 straightConnector1
521
- #
522
- # === Callout Shapes
523
- #
524
- # accentBorderCallout1 accentBorderCallout2 accentBorderCallout3
525
- # accentCallout1 accentCallout2 accentCallout3
526
- # borderCallout1 borderCallout2 borderCallout3
527
- # callout1 callout2 callout3
528
- # cloudCallout downArrowCallout leftArrowCallout
529
- # leftRightArrowCallout quadArrowCallout rightArrowCallout
530
- # upArrowCallout upDownArrowCallout wedgeEllipseCallout
531
- # wedgeRectCallout wedgeRoundRectCallout
532
- #
533
- # === Flow Chart Shapes
534
- #
535
- # flowChartAlternateProcess flowChartCollate flowChartConnector
536
- # flowChartDecision flowChartDelay flowChartDisplay
537
- # flowChartDocument flowChartExtract flowChartInputOutput
538
- # flowChartInternalStorage flowChartMagneticDisk flowChartMagneticDrum
539
- # flowChartMagneticTape flowChartManualInput flowChartManualOperation
540
- # flowChartMerge flowChartMultidocument flowChartOfflineStorage
541
- # flowChartOffpageConnector flowChartOnlineStorage flowChartOr
542
- # flowChartPredefinedProcess flowChartPreparation flowChartProcess
543
- # flowChartPunchedCard flowChartPunchedTape flowChartSort
544
- # flowChartSummingJunction flowChartTerminator
545
- #
546
- # === Action Shapes
547
- #
548
- # actionButtonBackPrevious actionButtonBeginning actionButtonBlank
549
- # actionButtonDocument actionButtonEnd actionButtonForwardNext
550
- # actionButtonHelp actionButtonHome actionButtonInformation
551
- # actionButtonMovie actionButtonReturn actionButtonSound
552
- #
553
- # === Chart Shapes
554
- #
555
- # Not to be confused with Excel Charts.
556
- #
557
- # chartPlus chartStar chartX
558
- #
559
- # === Math Shapes
560
- #
561
- # mathDivide mathEqual mathMinus mathMultiply mathNotEqual mathPlus
562
- #
563
- # === Starts and Banners
564
- #
565
- # arc bevel bracePair bracketPair chord
566
- # cloud corner diagStripe doubleWave ellipseRibbon
567
- # ellipseRibbon2 foldedCorner frame halfFrame horizontalScroll
568
- # irregularSeal1 irregularSeal2 leftBrace leftBracket leftRightRibbon
569
- # plus ribbon ribbon2 rightBrace rightBracket
570
- # verticalScroll wave
571
- #
572
- # === Tab Shapes
573
- #
574
- # cornerTabs plaqueTabs squareTabs
575
- #
576
- # === :text
577
- #
578
- # This property is used to make the shape act like a text box.
579
- #
580
- # rect = workbook.add_shape(:type => 'rect', :text => "Hello \nWorld")
581
- #
582
- # The Text is super-imposed over the shape. The text can be wrapped using
583
- # the newline character \n.
584
- #
585
- # === :id
586
- #
587
- # Identification number for internal identification. This number will be
588
- # auto-assigned, if not assigned, or if it is a duplicate.
589
- #
590
- # === :format
591
- #
592
- # Workbook format for decorating the shape horizontally and/or vertically.
593
- #
594
- # === :rotation
595
- #
596
- # Shape rotation, in degrees, from 0 to 360
597
- #
598
- # === :line, :fill
599
- #
600
- # Shape color for the outline and fill.
601
- # Colors may be specified as a color index, or in RGB format, i.e. AA00FF.
602
- #
603
- # See COULOURS IN EXCEL in the main documentation for more information.
604
- #
605
- # === :link_type
606
- #
607
- # Line type for shape outline. The default is solid.
608
- # The list of possible values is:
609
- #
610
- # dash, sysDot, dashDot, lgDash, lgDashDot, lgDashDotDot, solid
611
- #
612
- # === :valign, :align
613
- #
614
- # Text alignment within the shape.
615
- #
616
- # Vertical alignment can be:
617
- #
618
- # Setting Meaning
619
- # ======= =======
620
- # t Top
621
- # ctr Centre
622
- # b Bottom
623
- #
624
- # Horizontal alignment can be:
625
- #
626
- # Setting Meaning
627
- # ======= =======
628
- # l Left
629
- # r Right
630
- # ctr Centre
631
- # just Justified
632
- #
633
- # The default is to center both horizontally and vertically.
634
- #
635
- # === :scale_x, :scale_y
636
- #
637
- # Scale factor in x and y dimension, for scaling the shape width and
638
- # height. The default value is 1.
639
- #
640
- # Scaling may be set on the shape object or via insert_shape.
641
- #
642
- # === :adjustments
643
- #
644
- # Adjustment of shape vertices. Most shapes do not use this. For some
645
- # shapes, there is a single adjustment to modify the geometry.
646
- # For instance, the plus shape has one adjustment to control the width
647
- # of the spokes.
648
- #
649
- # Connectors can have a number of adjustments to control the shape
650
- # routing. Typically, a connector will have 3 to 5 handles for routing
651
- # the shape. The adjustment is in percent of the distance from the
652
- # starting shape to the ending shape, alternating between the x and y
653
- # dimension. Adjustments may be negative, to route the shape away
654
- # from the endpoint.
655
- #
656
- # === :stencil
657
- #
658
- # Shapes work in stencil mode by default. That is, once a shape is
659
- # inserted, its connection is separated from its master.
660
- # The master shape may be modified after an instance is inserted,
661
- # and only subsequent insertions will show the modifications.
662
- #
663
- # This is helpful for Org charts, where an employee shape may be
664
- # created once, and then the text of the shape is modified for each
665
- # employee.
666
- #
667
- # The insert_shape method returns a reference to the inserted
668
- # shape (the child).
669
- #
670
- # Stencil mode can be turned off, allowing for shape(s) to be
671
- # modified after insertion. In this case the insert_shape() method
672
- # returns a reference to the inserted shape (the master).
673
- # This is not very useful for inserting multiple shapes,
674
- # since the x/y coordinates also gets modified.
675
- #
676
294
  def add_shape(properties = {})
677
295
  shape = Shape.new(properties)
678
296
  shape.palette = @palette
@@ -686,31 +304,6 @@ module Writexlsx
686
304
  # Create a defined name in Excel. We handle global/workbook level names and
687
305
  # local/worksheet names.
688
306
  #
689
- # This method is used to defined a name that can be used to represent
690
- # a value, a single cell or a range of cells in a workbook.
691
- #
692
- # For example to set a global/workbook name:
693
- #
694
- # # Global/workbook names.
695
- # workbook.define_name('Exchange_rate', '=0.96')
696
- # workbook.define_name('Sales', '=Sheet1!$G$1:$H$10')
697
- #
698
- # It is also possible to define a local/worksheet name by prefixing the name
699
- # with the sheet name using the syntax +sheetname!definedname+:
700
- #
701
- # # Local/worksheet name.
702
- # workbook.define_name('Sheet2!Sales', '=Sheet2!$G$1:$G$10')
703
- #
704
- # If the sheet name contains spaces or special characters
705
- # you must enclose it in single quotes like in Excel:
706
- #
707
- # workbook.define_name("'New Data'!Sales", '=Sheet2!$G$1:$G$10')
708
- #
709
- # See the defined_name.rb program in the examples dir of the distro.
710
- #
711
- # Refer to the following to see Excel's syntax rules for defined names:
712
- # <http://office.microsoft.com/en-001/excel-help/define-and-use-names-in-formulas-HA010147120.aspx#BMsyntax_rules_for_names>
713
- #
714
307
  def define_name(name, formula)
715
308
  sheet_index = nil
716
309
  sheetname = ''
@@ -726,7 +319,7 @@ module Writexlsx
726
319
 
727
320
  # Raise if the sheet index wasn't found.
728
321
  if !sheet_index
729
- raise "Unknown sheet name #{sheetname} in defined_name()\n"
322
+ raise "Unknown sheet name #{sheetname} in defined_name()"
730
323
  end
731
324
 
732
325
  # Raise if the name contains invalid chars as defined by Excel help.
@@ -734,22 +327,54 @@ module Writexlsx
734
327
  # http://office.microsoft.com/en-001/excel-help/define-and-use-names-in-formulas-HA010147120.aspx#BMsyntax_rules_for_names
735
328
  #
736
329
  if name =~ /\A[-0-9 !"#\$%&'\(\)\*\+,\.:;<=>\?@\[\]\^`\{\}~]/ || name =~ /.+[- !"#\$%&'\(\)\*\+,\\:;<=>\?@\[\]\^`\{\}~]/
737
- raise "Invalid characters in name '#{name}' used in defined_name()\n"
330
+ raise "Invalid characters in name '#{name}' used in defined_name()"
738
331
  end
739
332
 
740
333
  # Raise if the name looks like a cell name.
741
334
  if name =~ %r(^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$)
742
- raise "Invalid name '#{name}' looks like a cell name in defined_name()\n"
335
+ raise "Invalid name '#{name}' looks like a cell name in defined_name()"
743
336
  end
744
337
 
745
338
  # Raise if the name looks like a R1C1
746
339
  if name =~ /\A[rcRC]\Z/ || name =~ /\A[rcRC]\d+[rcRC]\d+\Z/
747
- raise "Invalid name '#{name}' like a RC cell ref in defined_name()\n"
340
+ raise "Invalid name '#{name}' like a RC cell ref in defined_name()"
748
341
  end
749
342
 
750
343
  @defined_names.push([ name, sheet_index, formula.sub(/^=/, '') ])
751
344
  end
752
345
 
346
+ #
347
+ # Set the workbook size.
348
+ #
349
+ def set_size(width = nil, height = nil)
350
+ if ptrue?(width)
351
+ # Convert to twips at 96 dpi.
352
+ @window_width = width.to_i * 1440 / 96
353
+ else
354
+ @window_width = 16095
355
+ end
356
+
357
+ if ptrue?(height)
358
+ # Convert to twips at 96 dpi.
359
+ @window_height = height.to_i * 1440 / 96
360
+ else
361
+ @window_height = 9660
362
+ end
363
+ end
364
+
365
+ #
366
+ # Set the ratio of space for worksheet tabs.
367
+ #
368
+ def set_tab_ratio(tab_ratio = nil)
369
+ return if !tab_ratio
370
+
371
+ if tab_ratio < 0 || tab_ratio > 100
372
+ raise "Tab ratio outside range: 0 <= zoom <= 100"
373
+ else
374
+ @tab_ratio = (tab_ratio * 10).to_i
375
+ end
376
+ end
377
+
753
378
  #
754
379
  # The set_properties method can be used to set the document properties
755
380
  # of the Excel file created by WriteXLSX. These properties are visible
@@ -757,46 +382,24 @@ module Writexlsx
757
382
  # and are also available to external applications that read or index windows
758
383
  # files.
759
384
  #
760
- # The properties should be passed in hash format as follows:
761
- #
762
- # workbook.set_properties(
763
- # :title => 'This is an example spreadsheet',
764
- # :author => 'Hideo NAKAMURA',
765
- # :comments => 'Created with Ruby and WriteXLSX'
766
- # )
767
- #
768
- # The properties that can be set are:
769
- #
770
- # :title
771
- # :subject
772
- # :author
773
- # :manager
774
- # :company
775
- # :category
776
- # :keywords
777
- # :comments
778
- # :status
779
- #
780
- # See also the properties.rb program in the examples directory
781
- # of the distro.
782
- #
783
385
  def set_properties(params)
784
386
  # Ignore if no args were passed.
785
387
  return -1 if params.empty?
786
388
 
787
389
  # List of valid input parameters.
788
390
  valid = {
789
- :title => 1,
790
- :subject => 1,
791
- :author => 1,
792
- :keywords => 1,
793
- :comments => 1,
794
- :last_author => 1,
795
- :created => 1,
796
- :category => 1,
797
- :manager => 1,
798
- :company => 1,
799
- :status => 1
391
+ :title => 1,
392
+ :subject => 1,
393
+ :author => 1,
394
+ :keywords => 1,
395
+ :comments => 1,
396
+ :last_author => 1,
397
+ :created => 1,
398
+ :category => 1,
399
+ :manager => 1,
400
+ :company => 1,
401
+ :status => 1,
402
+ :hyperlink_base => 1
800
403
  }
801
404
 
802
405
  # Check for valid input parameters.
@@ -805,37 +408,63 @@ module Writexlsx
805
408
  end
806
409
 
807
410
  # Set the creation time unless specified by the user.
808
- params[:created] = @local_time unless params.has_key?(:created)
411
+ params[:created] = @createtime unless params.has_key?(:created)
809
412
 
810
413
  @doc_properties = params.dup
811
414
  end
812
415
 
416
+ #
417
+ # Set a user defined custom document property.
418
+ #
419
+ def set_custom_property(name, value, type = nil)
420
+ # Valid types.
421
+ valid_type = {
422
+ 'text' => 1,
423
+ 'date' => 1,
424
+ 'number' => 1,
425
+ 'number_int' => 1,
426
+ 'bool' => 1,
427
+ }
428
+
429
+ if !name || (type != 'bool' && !value)
430
+ raise "The name and value parameters must be defined in set_custom_property()"
431
+ end
432
+
433
+ # Determine the type for strings and numbers if it hasn't been specified.
434
+ if !ptrue?(type)
435
+ if value =~ /^\d+$/
436
+ type = 'number_int'
437
+ elsif value =~
438
+ /^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/
439
+ type = 'number'
440
+ else
441
+ type = 'text'
442
+ end
443
+ end
444
+
445
+ # Check for valid validation types.
446
+ if !valid_type[type]
447
+ raise "Unknown custom type '$type' in set_custom_property()"
448
+ end
449
+
450
+ # Check for strings longer than Excel's limit of 255 chars.
451
+ if type == 'text' && value.length > 255
452
+ raise "Length of text custom value '$value' exceeds Excel's limit of 255 in set_custom_property()"
453
+ end
454
+
455
+ if type == 'bool'
456
+ value = value ? 1 : 0
457
+ end
458
+
459
+ @custom_properties << [name, value, type]
460
+ end
461
+
462
+
813
463
  #
814
464
  # The add_vba_project method can be used to add macros or functions to an
815
465
  # WriteXLSX file using a binary VBA project file that has been extracted
816
466
  # from an existing Excel xlsm file.
817
467
  #
818
- # workbook = WriteXLSX.new('file.xlsm')
819
- #
820
- # workbook.add_vba_project('./vbaProject.bin')
821
- #
822
- # The supplied +extract_vba+ utility can be used to extract the required
823
- # +vbaProject.bin+ file from an existing Excel file:
824
- #
825
- # $ extract_vba file.xlsm
826
- # Extracted 'vbaProject.bin' successfully
827
- #
828
- # Macros can be tied to buttons using the worksheet
829
- # {insert_button}[Worksheet.html#method-i-insert_button] method
830
- # (see the "WORKSHEET METHODS" section for details):
831
- #
832
- # worksheet.insert_button('C2', { :macro => 'my_macro' })
833
- #
834
- # Note, Excel uses the file extension xlsm instead of xlsx for files that
835
- # contain macros. It is advisable to follow the same convention.
836
- #
837
- # See also the macros.rb example file.
838
- #
839
468
  def add_vba_project(vba_project)
840
469
  @vba_project = vba_project
841
470
  end
@@ -851,6 +480,13 @@ module Writexlsx
851
480
  end
852
481
  end
853
482
 
483
+ #
484
+ # Set the Excel "Read-only recommended" save option.
485
+ #
486
+ def read_only_recommended
487
+ @read_only = 2
488
+ end
489
+
854
490
  #
855
491
  # set_calc_mode()
856
492
  #
@@ -869,61 +505,17 @@ module Writexlsx
869
505
  end
870
506
 
871
507
  #
872
- # Change the RGB components of the elements in the colour palette.
873
- #
874
- # The set_custom_color method can be used to override one of the built-in
875
- # palette values with a more suitable colour.
876
- #
877
- # The value for +index+ should be in the range 8..63,
878
- # see "COLOURS IN EXCEL".
879
- #
880
- # The default named colours use the following indices:
508
+ # Get the default url format used when a user defined format isn't specified
509
+ # with write_url(). The format is the hyperlink style defined by Excel for the
510
+ # default theme.
881
511
  #
882
- # 8 => black
883
- # 9 => white
884
- # 10 => red
885
- # 11 => lime
886
- # 12 => blue
887
- # 13 => yellow
888
- # 14 => magenta
889
- # 15 => cyan
890
- # 16 => brown
891
- # 17 => green
892
- # 18 => navy
893
- # 20 => purple
894
- # 22 => silver
895
- # 23 => gray
896
- # 33 => pink
897
- # 53 => orange
898
- #
899
- # A new colour is set using its RGB (red green blue) components. The +red+,
900
- # +green+ and +blue+ values must be in the range 0..255. You can determine
901
- # the required values in Excel using the Tools->Options->Colors->Modify
902
- # dialog.
903
- #
904
- # The set_custom_color workbook method can also be used with a HTML style
905
- # +#rrggbb+ hex value:
906
- #
907
- # workbook.set_custom_color(40, 255, 102, 0 ) # Orange
908
- # workbook.set_custom_color(40, 0xFF, 0x66, 0x00) # Same thing
909
- # workbook.set_custom_color(40, '#FF6600' ) # Same thing
910
- #
911
- # font = workbook.add_format(:color => 40) # Use the modified colour
912
- #
913
- # The return value from set_custom_color() is the index of the colour that
914
- # was changed:
915
- #
916
- # ferrari = workbook.set_custom_color(40, 216, 12, 12)
917
- #
918
- # format = workbook.add_format(
919
- # :bg_color => ferrari,
920
- # :pattern => 1,
921
- # :border => 1
922
- # )
512
+ def default_url_format
513
+ @default_url_format
514
+ end
515
+ alias get_default_url_format default_url_format
516
+
923
517
  #
924
- # Note, In the XLSX format the color palette isn't actually confined to 53
925
- # unique colors. The WriteXLSX gem will be extended at a later stage to
926
- # support the newer, semi-infinite, palette.
518
+ # Change the RGB components of the elements in the colour palette.
927
519
  #
928
520
  def set_custom_color(index, red = 0, green = 0, blue = 0)
929
521
  # Match a HTML #xxyyzz style parameter
@@ -996,14 +588,15 @@ module Writexlsx
996
588
 
997
589
  def style_properties
998
590
  [
999
- @xf_formats,
1000
- @palette,
1001
- @font_count,
1002
- @num_format_count,
1003
- @border_count,
1004
- @fill_count,
1005
- @custom_colors,
1006
- @dxf_formats
591
+ @xf_formats,
592
+ @palette,
593
+ @font_count,
594
+ @num_format_count,
595
+ @border_count,
596
+ @fill_count,
597
+ @custom_colors,
598
+ @dxf_formats,
599
+ @has_comments
1007
600
  ]
1008
601
  end
1009
602
 
@@ -1031,6 +624,10 @@ module Writexlsx
1031
624
  @activesheet ||= 0
1032
625
  end
1033
626
 
627
+ def has_metadata?
628
+ @has_metadata
629
+ end
630
+
1034
631
  private
1035
632
 
1036
633
  def filename
@@ -1064,63 +661,63 @@ module Writexlsx
1064
661
  #
1065
662
  def set_color_palette #:nodoc:
1066
663
  @palette = [
1067
- [ 0x00, 0x00, 0x00, 0x00 ], # 8
1068
- [ 0xff, 0xff, 0xff, 0x00 ], # 9
1069
- [ 0xff, 0x00, 0x00, 0x00 ], # 10
1070
- [ 0x00, 0xff, 0x00, 0x00 ], # 11
1071
- [ 0x00, 0x00, 0xff, 0x00 ], # 12
1072
- [ 0xff, 0xff, 0x00, 0x00 ], # 13
1073
- [ 0xff, 0x00, 0xff, 0x00 ], # 14
1074
- [ 0x00, 0xff, 0xff, 0x00 ], # 15
1075
- [ 0x80, 0x00, 0x00, 0x00 ], # 16
1076
- [ 0x00, 0x80, 0x00, 0x00 ], # 17
1077
- [ 0x00, 0x00, 0x80, 0x00 ], # 18
1078
- [ 0x80, 0x80, 0x00, 0x00 ], # 19
1079
- [ 0x80, 0x00, 0x80, 0x00 ], # 20
1080
- [ 0x00, 0x80, 0x80, 0x00 ], # 21
1081
- [ 0xc0, 0xc0, 0xc0, 0x00 ], # 22
1082
- [ 0x80, 0x80, 0x80, 0x00 ], # 23
1083
- [ 0x99, 0x99, 0xff, 0x00 ], # 24
1084
- [ 0x99, 0x33, 0x66, 0x00 ], # 25
1085
- [ 0xff, 0xff, 0xcc, 0x00 ], # 26
1086
- [ 0xcc, 0xff, 0xff, 0x00 ], # 27
1087
- [ 0x66, 0x00, 0x66, 0x00 ], # 28
1088
- [ 0xff, 0x80, 0x80, 0x00 ], # 29
1089
- [ 0x00, 0x66, 0xcc, 0x00 ], # 30
1090
- [ 0xcc, 0xcc, 0xff, 0x00 ], # 31
1091
- [ 0x00, 0x00, 0x80, 0x00 ], # 32
1092
- [ 0xff, 0x00, 0xff, 0x00 ], # 33
1093
- [ 0xff, 0xff, 0x00, 0x00 ], # 34
1094
- [ 0x00, 0xff, 0xff, 0x00 ], # 35
1095
- [ 0x80, 0x00, 0x80, 0x00 ], # 36
1096
- [ 0x80, 0x00, 0x00, 0x00 ], # 37
1097
- [ 0x00, 0x80, 0x80, 0x00 ], # 38
1098
- [ 0x00, 0x00, 0xff, 0x00 ], # 39
1099
- [ 0x00, 0xcc, 0xff, 0x00 ], # 40
1100
- [ 0xcc, 0xff, 0xff, 0x00 ], # 41
1101
- [ 0xcc, 0xff, 0xcc, 0x00 ], # 42
1102
- [ 0xff, 0xff, 0x99, 0x00 ], # 43
1103
- [ 0x99, 0xcc, 0xff, 0x00 ], # 44
1104
- [ 0xff, 0x99, 0xcc, 0x00 ], # 45
1105
- [ 0xcc, 0x99, 0xff, 0x00 ], # 46
1106
- [ 0xff, 0xcc, 0x99, 0x00 ], # 47
1107
- [ 0x33, 0x66, 0xff, 0x00 ], # 48
1108
- [ 0x33, 0xcc, 0xcc, 0x00 ], # 49
1109
- [ 0x99, 0xcc, 0x00, 0x00 ], # 50
1110
- [ 0xff, 0xcc, 0x00, 0x00 ], # 51
1111
- [ 0xff, 0x99, 0x00, 0x00 ], # 52
1112
- [ 0xff, 0x66, 0x00, 0x00 ], # 53
1113
- [ 0x66, 0x66, 0x99, 0x00 ], # 54
1114
- [ 0x96, 0x96, 0x96, 0x00 ], # 55
1115
- [ 0x00, 0x33, 0x66, 0x00 ], # 56
1116
- [ 0x33, 0x99, 0x66, 0x00 ], # 57
1117
- [ 0x00, 0x33, 0x00, 0x00 ], # 58
1118
- [ 0x33, 0x33, 0x00, 0x00 ], # 59
1119
- [ 0x99, 0x33, 0x00, 0x00 ], # 60
1120
- [ 0x99, 0x33, 0x66, 0x00 ], # 61
1121
- [ 0x33, 0x33, 0x99, 0x00 ], # 62
1122
- [ 0x33, 0x33, 0x33, 0x00 ], # 63
1123
- ]
664
+ [ 0x00, 0x00, 0x00, 0x00 ], # 8
665
+ [ 0xff, 0xff, 0xff, 0x00 ], # 9
666
+ [ 0xff, 0x00, 0x00, 0x00 ], # 10
667
+ [ 0x00, 0xff, 0x00, 0x00 ], # 11
668
+ [ 0x00, 0x00, 0xff, 0x00 ], # 12
669
+ [ 0xff, 0xff, 0x00, 0x00 ], # 13
670
+ [ 0xff, 0x00, 0xff, 0x00 ], # 14
671
+ [ 0x00, 0xff, 0xff, 0x00 ], # 15
672
+ [ 0x80, 0x00, 0x00, 0x00 ], # 16
673
+ [ 0x00, 0x80, 0x00, 0x00 ], # 17
674
+ [ 0x00, 0x00, 0x80, 0x00 ], # 18
675
+ [ 0x80, 0x80, 0x00, 0x00 ], # 19
676
+ [ 0x80, 0x00, 0x80, 0x00 ], # 20
677
+ [ 0x00, 0x80, 0x80, 0x00 ], # 21
678
+ [ 0xc0, 0xc0, 0xc0, 0x00 ], # 22
679
+ [ 0x80, 0x80, 0x80, 0x00 ], # 23
680
+ [ 0x99, 0x99, 0xff, 0x00 ], # 24
681
+ [ 0x99, 0x33, 0x66, 0x00 ], # 25
682
+ [ 0xff, 0xff, 0xcc, 0x00 ], # 26
683
+ [ 0xcc, 0xff, 0xff, 0x00 ], # 27
684
+ [ 0x66, 0x00, 0x66, 0x00 ], # 28
685
+ [ 0xff, 0x80, 0x80, 0x00 ], # 29
686
+ [ 0x00, 0x66, 0xcc, 0x00 ], # 30
687
+ [ 0xcc, 0xcc, 0xff, 0x00 ], # 31
688
+ [ 0x00, 0x00, 0x80, 0x00 ], # 32
689
+ [ 0xff, 0x00, 0xff, 0x00 ], # 33
690
+ [ 0xff, 0xff, 0x00, 0x00 ], # 34
691
+ [ 0x00, 0xff, 0xff, 0x00 ], # 35
692
+ [ 0x80, 0x00, 0x80, 0x00 ], # 36
693
+ [ 0x80, 0x00, 0x00, 0x00 ], # 37
694
+ [ 0x00, 0x80, 0x80, 0x00 ], # 38
695
+ [ 0x00, 0x00, 0xff, 0x00 ], # 39
696
+ [ 0x00, 0xcc, 0xff, 0x00 ], # 40
697
+ [ 0xcc, 0xff, 0xff, 0x00 ], # 41
698
+ [ 0xcc, 0xff, 0xcc, 0x00 ], # 42
699
+ [ 0xff, 0xff, 0x99, 0x00 ], # 43
700
+ [ 0x99, 0xcc, 0xff, 0x00 ], # 44
701
+ [ 0xff, 0x99, 0xcc, 0x00 ], # 45
702
+ [ 0xcc, 0x99, 0xff, 0x00 ], # 46
703
+ [ 0xff, 0xcc, 0x99, 0x00 ], # 47
704
+ [ 0x33, 0x66, 0xff, 0x00 ], # 48
705
+ [ 0x33, 0xcc, 0xcc, 0x00 ], # 49
706
+ [ 0x99, 0xcc, 0x00, 0x00 ], # 50
707
+ [ 0xff, 0xcc, 0x00, 0x00 ], # 51
708
+ [ 0xff, 0x99, 0x00, 0x00 ], # 52
709
+ [ 0xff, 0x66, 0x00, 0x00 ], # 53
710
+ [ 0x66, 0x66, 0x99, 0x00 ], # 54
711
+ [ 0x96, 0x96, 0x96, 0x00 ], # 55
712
+ [ 0x00, 0x33, 0x66, 0x00 ], # 56
713
+ [ 0x33, 0x99, 0x66, 0x00 ], # 57
714
+ [ 0x00, 0x33, 0x00, 0x00 ], # 58
715
+ [ 0x33, 0x33, 0x00, 0x00 ], # 59
716
+ [ 0x99, 0x33, 0x00, 0x00 ], # 60
717
+ [ 0x99, 0x33, 0x66, 0x00 ], # 61
718
+ [ 0x33, 0x33, 0x99, 0x00 ], # 62
719
+ [ 0x33, 0x33, 0x33, 0x00 ], # 63
720
+ ]
1124
721
  end
1125
722
 
1126
723
  #
@@ -1184,11 +781,11 @@ module Writexlsx
1184
781
 
1185
782
  def write_file_version #:nodoc:
1186
783
  attributes = [
1187
- ['appName', 'xl'],
1188
- ['lastEdited', 4],
1189
- ['lowestEdited', 4],
1190
- ['rupBuild', 4505]
1191
- ]
784
+ ['appName', 'xl'],
785
+ ['lastEdited', 4],
786
+ ['lowestEdited', 4],
787
+ ['rupBuild', 4505]
788
+ ]
1192
789
 
1193
790
  if @vba_project
1194
791
  attributes << [:codeName, '{37E998C4-C9E5-D4B9-71C8-EB1FF731991C}']
@@ -1197,6 +794,17 @@ module Writexlsx
1197
794
  @writer.empty_tag('fileVersion', attributes)
1198
795
  end
1199
796
 
797
+ #
798
+ # Write the <fileSharing> element.
799
+ #
800
+ def write_file_sharing
801
+ return if !ptrue?(@read_only)
802
+
803
+ attributes = []
804
+ attributes << ['readOnlyRecommended', 1]
805
+ @writer.empty_tag('fileSharing', attributes)
806
+ end
807
+
1200
808
  def write_workbook_pr #:nodoc:
1201
809
  attributes = []
1202
810
  attributes << ['codeName', @vba_codename] if ptrue?(@vba_codename)
@@ -1211,12 +819,12 @@ module Writexlsx
1211
819
 
1212
820
  def write_workbook_view #:nodoc:
1213
821
  attributes = [
1214
- ['xWindow', @x_window],
1215
- ['yWindow', @y_window],
1216
- ['windowWidth', @window_width],
1217
- ['windowHeight', @window_height]
1218
- ]
1219
- if @tab_ratio != 500
822
+ ['xWindow', @x_window],
823
+ ['yWindow', @y_window],
824
+ ['windowWidth', @window_width],
825
+ ['windowHeight', @window_height]
826
+ ]
827
+ if @tab_ratio != 600
1220
828
  attributes << ['tabRatio', @tab_ratio]
1221
829
  end
1222
830
  if @firstsheet > 0
@@ -1313,6 +921,9 @@ module Writexlsx
1313
921
  # Prepare the worksheet tables.
1314
922
  prepare_tables
1315
923
 
924
+ # Prepare the metadata file links.
925
+ prepare_metadata
926
+
1316
927
  # Package the workbook.
1317
928
  packager = Package::Packager.new(self)
1318
929
  packager.set_package_dir(tempdir)
@@ -1420,9 +1031,17 @@ module Writexlsx
1420
1031
  # string but would evaluate to zero.
1421
1032
  #
1422
1033
  if num_format.to_s =~ /^\d+$/ && num_format.to_s !~ /^0+\d/
1034
+ # Number format '0' is indexed as 1 in Excel.
1035
+ if num_format == 0
1036
+ num_format = 1
1037
+ end
1423
1038
  # Index to a built-in number format.
1424
1039
  format.num_format_index = num_format
1425
1040
  next
1041
+ elsif num_format.to_s == 'General'
1042
+ # The 'General' format has an number format index of 0.
1043
+ format.num_format_index = 0
1044
+ next
1426
1045
  end
1427
1046
 
1428
1047
  if num_formats[num_format]
@@ -1540,20 +1159,20 @@ module Writexlsx
1540
1159
  # Check for Print Area settings.
1541
1160
  if sheet.autofilter_area
1542
1161
  @defined_names << [
1543
- '_xlnm._FilterDatabase',
1544
- sheet.index,
1545
- sheet.autofilter_area,
1546
- 1
1547
- ]
1162
+ '_xlnm._FilterDatabase',
1163
+ sheet.index,
1164
+ sheet.autofilter_area,
1165
+ 1
1166
+ ]
1548
1167
  end
1549
1168
 
1550
1169
  # Check for Print Area settings.
1551
1170
  if !sheet.print_area.empty?
1552
1171
  @defined_names << [
1553
- '_xlnm.Print_Area',
1554
- sheet.index,
1555
- sheet.print_area
1556
- ]
1172
+ '_xlnm.Print_Area',
1173
+ sheet.index,
1174
+ sheet.print_area
1175
+ ]
1557
1176
  end
1558
1177
 
1559
1178
  # Check for repeat rows/cols. aka, Print Titles.
@@ -1591,11 +1210,14 @@ module Writexlsx
1591
1210
  if sheet.has_comments?
1592
1211
  comment_files += 1
1593
1212
  comment_id += 1
1213
+ @has_comments = true
1594
1214
  end
1595
1215
  vml_drawing_id += 1
1596
1216
 
1597
- sheet.prepare_vml_objects(vml_data_id, vml_shape_id,
1598
- vml_drawing_id, comment_id)
1217
+ sheet.prepare_vml_objects(
1218
+ vml_data_id, vml_shape_id,
1219
+ vml_drawing_id, comment_id
1220
+ )
1599
1221
 
1600
1222
  # Each VML file should start with a shape id incremented by 1024.
1601
1223
  vml_data_id += 1 * ( 1 + sheet.num_comments_block )
@@ -1618,8 +1240,6 @@ module Writexlsx
1618
1240
  end
1619
1241
  end
1620
1242
 
1621
- add_font_format_for_cell_comments if num_comment_files > 0
1622
-
1623
1243
  # Set the workbook vba_codename if one of the sheets has a button and
1624
1244
  # the workbook has a vbaProject binary.
1625
1245
  if has_button && @vba_project && !@vba_codename
@@ -1632,23 +1252,23 @@ module Writexlsx
1632
1252
  #
1633
1253
  def prepare_tables
1634
1254
  table_id = 0
1255
+ seen = {}
1635
1256
 
1636
1257
  sheets.each do |sheet|
1637
- table_id += sheet.prepare_tables(table_id + 1)
1258
+ table_id += sheet.prepare_tables(table_id + 1, seen)
1638
1259
  end
1639
1260
  end
1640
1261
 
1641
- def add_font_format_for_cell_comments
1642
- format = Format.new(
1643
- @formats,
1644
- :font => 'Tahoma',
1645
- :size => 8,
1646
- :color_indexed => 81,
1647
- :font_only => 1
1648
- )
1649
-
1650
- format.get_xf_index
1651
- @formats.formats << format
1262
+ #
1263
+ # Set the metadata rel link.
1264
+ #
1265
+ def prepare_metadata
1266
+ @worksheets.each do |sheet|
1267
+ if sheet.has_dynamic_arrays?
1268
+ @has_metadata = true
1269
+ break
1270
+ end
1271
+ end
1652
1272
  end
1653
1273
 
1654
1274
  #
@@ -1801,37 +1421,69 @@ module Writexlsx
1801
1421
  # Iterate through the worksheets and set up any chart or image drawings.
1802
1422
  #
1803
1423
  def prepare_drawings #:nodoc:
1804
- chart_ref_id = 0
1805
- image_ref_id = 0
1806
- drawing_id = 0
1424
+ chart_ref_id = 0
1425
+ image_ref_id = 0
1426
+ drawing_id = 0
1427
+ ref_id = 0
1428
+ image_ids = {}
1429
+ header_image_ids = {}
1430
+ background_ids = {}
1807
1431
  @worksheets.each do |sheet|
1808
1432
  chart_count = sheet.charts.size
1809
1433
  image_count = sheet.images.size
1810
1434
  shape_count = sheet.shapes.size
1811
1435
  header_image_count = sheet.header_images.size
1812
1436
  footer_image_count = sheet.footer_images.size
1813
- has_drawing = false
1437
+ has_background = sheet.background_image.size
1438
+ has_drawings = false
1814
1439
 
1815
1440
  # Check that some image or drawing needs to be processed.
1816
- next if chart_count + image_count + shape_count + header_image_count + footer_image_count == 0
1441
+ next if chart_count + image_count + shape_count + header_image_count + footer_image_count + has_background == 0
1817
1442
 
1818
1443
  # Don't increase the drawing_id header/footer images.
1819
1444
  if chart_count + image_count + shape_count > 0
1820
1445
  drawing_id += 1
1821
- has_drawing = true
1446
+ has_drawings = true
1822
1447
  end
1823
1448
 
1824
- # Prepare the worksheet charts.
1825
- sheet.charts.each_with_index do |chart, index|
1826
- chart_ref_id += 1
1827
- sheet.prepare_chart(index, chart_ref_id, drawing_id)
1449
+ # Prepare the background images.
1450
+ if ptrue?(has_background)
1451
+ filename = sheet.background_image
1452
+ type, width, height, name, x_dpi, y_dpi, md5 = get_image_properties(filename)
1453
+
1454
+ if background_ids[md5]
1455
+ ref_id = background_ids[md5]
1456
+ else
1457
+ image_ref_id += 1
1458
+ ref_id = image_ref_id
1459
+ background_ids[md5] = ref_id
1460
+ @images << [filename, type]
1461
+ end
1462
+
1463
+ sheet.prepare_background(ref_id, type)
1828
1464
  end
1829
1465
 
1830
1466
  # Prepare the worksheet images.
1831
1467
  sheet.images.each_with_index do |image, index|
1832
- type, width, height, name, x_dpi, y_dpi = get_image_properties(image[2])
1833
- image_ref_id += 1
1834
- sheet.prepare_image(index, image_ref_id, drawing_id, width, height, name, type, x_dpi, y_dpi)
1468
+ filename = image[2]
1469
+ type, width, height, name, x_dpi, y_dpi, md5 = get_image_properties(image[2])
1470
+ if image_ids[md5]
1471
+ ref_id = image_ids[md5]
1472
+ else
1473
+ image_ref_id += 1
1474
+ image_ids[md5] = ref_id = image_ref_id
1475
+ @images << [filename, type]
1476
+ end
1477
+ sheet.prepare_image(
1478
+ index, ref_id, drawing_id, width, height,
1479
+ name, type, x_dpi, y_dpi, md5
1480
+ )
1481
+ end
1482
+
1483
+ # Prepare the worksheet charts.
1484
+ sheet.charts.each_with_index do |chart, index|
1485
+ chart_ref_id += 1
1486
+ sheet.prepare_chart(index, chart_ref_id, drawing_id)
1835
1487
  end
1836
1488
 
1837
1489
  # Prepare the worksheet shapes.
@@ -1844,13 +1496,21 @@ module Writexlsx
1844
1496
  filename = sheet.header_images[index][0]
1845
1497
  position = sheet.header_images[index][1]
1846
1498
 
1847
- type, width, height, name, x_dpi, y_dpi =
1499
+ type, width, height, name, x_dpi, y_dpi, md5 =
1848
1500
  get_image_properties(filename)
1849
1501
 
1850
- image_ref_id += 1
1502
+ if header_image_ids[md5]
1503
+ ref_id = header_image_ids[md5]
1504
+ else
1505
+ image_ref_id += 1
1506
+ header_image_ids[md5] = ref_id = image_ref_id
1507
+ @images << [filename, type]
1508
+ end
1851
1509
 
1852
- sheet.prepare_header_image(image_ref_id, width, height,
1853
- name, type, position, x_dpi, y_dpi)
1510
+ sheet.prepare_header_image(
1511
+ ref_id, width, height, name, type,
1512
+ position, x_dpi, y_dpi, md5
1513
+ )
1854
1514
  end
1855
1515
 
1856
1516
  # Prepare the footer images.
@@ -1858,18 +1518,26 @@ module Writexlsx
1858
1518
  filename = sheet.footer_images[index][0]
1859
1519
  position = sheet.footer_images[index][1]
1860
1520
 
1861
- type, width, height, name, x_dpi, y_dpi =
1521
+ type, width, height, name, x_dpi, y_dpi, md5 =
1862
1522
  get_image_properties(filename)
1863
1523
 
1864
- image_ref_id += 1
1524
+ if header_image_ids[md5]
1525
+ ref_id = header_image_ids[md5]
1526
+ else
1527
+ image_ref_id += 1
1528
+ header_image_ids[md5] = ref_id = image_ref_id
1529
+ @images << [filename, type]
1530
+ end
1865
1531
 
1866
- sheet.prepare_header_image(image_ref_id, width, height,
1867
- name, type, position, x_dpi, y_dpi)
1532
+ sheet.prepare_header_image(
1533
+ ref_id, width, height, name, type,
1534
+ position, x_dpi, y_dpi, md5
1535
+ )
1868
1536
  end
1869
1537
 
1870
- if has_drawing
1871
- drawing = sheet.drawing
1872
- @drawings << drawing
1538
+ if has_drawings
1539
+ drawings = sheet.drawings
1540
+ @drawings << drawings
1873
1541
  end
1874
1542
  end
1875
1543
 
@@ -1893,6 +1561,7 @@ module Writexlsx
1893
1561
 
1894
1562
  # Open the image file and import the data.
1895
1563
  data = File.binread(filename)
1564
+ md5 = Digest::MD5.hexdigest(data)
1896
1565
  if data.unpack('x A3')[0] == 'PNG'
1897
1566
  # Test for PNGs.
1898
1567
  type, width, height, x_dpi, y_dpi = process_png(data)
@@ -1901,6 +1570,10 @@ module Writexlsx
1901
1570
  # Test for JPEG files.
1902
1571
  type, width, height, x_dpi, y_dpi = process_jpg(data, filename)
1903
1572
  @image_types[:jpeg] = 1
1573
+ elsif data.unpack('A4')[0] == 'GIF8'
1574
+ # Test for GIFs.
1575
+ type, width, height, x_dpi, y_dpi = process_gif(data, filename)
1576
+ @image_types[:gif] = 1
1904
1577
  elsif data.unpack('A2')[0] == 'BM'
1905
1578
  # Test for BMPs.
1906
1579
  type, width, height = process_bmp(data, filename)
@@ -1910,9 +1583,11 @@ module Writexlsx
1910
1583
  raise "Unsupported image format for file: #{filename}\n"
1911
1584
  end
1912
1585
 
1913
- @images << [filename, type]
1586
+ # Set a default dpi for images with 0 dpi.
1587
+ x_dpi = 96 if x_dpi == 0
1588
+ y_dpi = 96 if y_dpi == 0
1914
1589
 
1915
- [type, width, height, File.basename(filename), x_dpi, y_dpi]
1590
+ [type, width, height, File.basename(filename), x_dpi, y_dpi, md5]
1916
1591
  end
1917
1592
 
1918
1593
  #
@@ -1967,16 +1642,20 @@ module Writexlsx
1967
1642
  offset = 2
1968
1643
  data_length = data.bytesize
1969
1644
 
1970
- # Search through the image data to read the height and width in the
1971
- # 0xFFC0/C2 element. Also read the DPI in the 0xFFE0 element.
1645
+ # Search through the image data to read the JPEG markers.
1972
1646
  while offset < data_length
1973
1647
  marker = data[offset+0, 2].unpack("n")[0]
1974
1648
  length = data[offset+2, 2].unpack("n")[0]
1975
1649
 
1976
- if marker == 0xFFC0 || marker == 0xFFC2
1650
+ # Read the height and width in the 0xFFCn elements
1651
+ # (Except C4, C8 and CC which aren't SOF markers).
1652
+ if (marker & 0xFFF0) == 0xFFC0 &&
1653
+ marker != 0xFFC4 && marker != 0xFFCC
1977
1654
  height = data[offset+5, 2].unpack("n")[0]
1978
1655
  width = data[offset+7, 2].unpack("n")[0]
1979
1656
  end
1657
+
1658
+ # Read the DPI in the 0xFFE0 element.
1980
1659
  if marker == 0xFFE0
1981
1660
  units = data[offset + 11, 1].unpack("C")[0]
1982
1661
  x_density = data[offset + 12, 2].unpack("n")[0]
@@ -1999,6 +1678,24 @@ module Writexlsx
1999
1678
  [type, width, height, x_dpi, y_dpi]
2000
1679
  end
2001
1680
 
1681
+ #
1682
+ # Extract width and height information from a GIF file.
1683
+ #
1684
+ def process_gif(data, filename)
1685
+ type = 'gif'
1686
+ x_dpi = 96
1687
+ y_dpi = 96
1688
+
1689
+ width = data[6, 2].unpack("v")[0]
1690
+ height = data[8, 2].unpack("v")[0]
1691
+
1692
+ if height.nil?
1693
+ raise "#{filename}: no size data found in gif image.\n"
1694
+ end
1695
+
1696
+ [type, width, height, x_dpi, y_dpi]
1697
+ end
1698
+
2002
1699
  # Extract width and height information from a BMP file.
2003
1700
  def process_bmp(data, filename) #:nodoc:
2004
1701
  type = 'bmp'