write_xlsx 0.85.4 → 0.85.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (615) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/Changes +16 -1
  4. data/lib/write_xlsx/chart.rb +1 -1
  5. data/lib/write_xlsx/compatibility.rb +1 -1
  6. data/lib/write_xlsx/format.rb +2 -3
  7. data/lib/write_xlsx/package/conditional_format.rb +2 -2
  8. data/lib/write_xlsx/package/shared_strings.rb +17 -13
  9. data/lib/write_xlsx/package/styles.rb +1 -1
  10. data/lib/write_xlsx/package/xml_writer_simple.rb +8 -8
  11. data/lib/write_xlsx/utility.rb +5 -3
  12. data/lib/write_xlsx/version.rb +1 -1
  13. data/lib/write_xlsx/workbook.rb +5 -3
  14. data/lib/write_xlsx/worksheet.rb +15 -13
  15. data/lib/write_xlsx/worksheet/cell_data.rb +3 -1
  16. data/lib/write_xlsx/worksheet/data_validation.rb +1 -1
  17. data/lib/write_xlsx/worksheet/hyperlink.rb +2 -2
  18. data/test/helper.rb +20 -0
  19. data/test/regression/disabled_test_vml04.rb +2 -2
  20. data/test/regression/test_array_formula01.rb +6 -6
  21. data/test/regression/test_array_formula02.rb +6 -6
  22. data/test/regression/test_autofilter00.rb +3 -3
  23. data/test/regression/test_autofilter01.rb +3 -3
  24. data/test/regression/test_autofilter02.rb +3 -3
  25. data/test/regression/test_autofilter03.rb +3 -3
  26. data/test/regression/test_autofilter04.rb +3 -3
  27. data/test/regression/test_autofilter05.rb +3 -3
  28. data/test/regression/test_autofilter06.rb +3 -3
  29. data/test/regression/test_autofilter07.rb +3 -3
  30. data/test/regression/test_button01.rb +3 -3
  31. data/test/regression/test_button02.rb +3 -3
  32. data/test/regression/test_button03.rb +3 -3
  33. data/test/regression/test_button04.rb +3 -3
  34. data/test/regression/test_button05.rb +3 -3
  35. data/test/regression/test_button06.rb +3 -3
  36. data/test/regression/test_button07.rb +3 -3
  37. data/test/regression/test_button08.rb +3 -3
  38. data/test/regression/test_button13.rb +2 -6
  39. data/test/regression/test_button14.rb +3 -3
  40. data/test/regression/test_chart_area01.rb +3 -3
  41. data/test/regression/test_chart_area02.rb +3 -3
  42. data/test/regression/test_chart_area03.rb +3 -3
  43. data/test/regression/test_chart_area04.rb +3 -3
  44. data/test/regression/test_chart_axis01.rb +6 -7
  45. data/test/regression/test_chart_axis02.rb +6 -7
  46. data/test/regression/test_chart_axis03.rb +9 -10
  47. data/test/regression/test_chart_axis04.rb +8 -9
  48. data/test/regression/test_chart_axis05.rb +8 -9
  49. data/test/regression/test_chart_axis06.rb +8 -9
  50. data/test/regression/test_chart_axis07.rb +8 -9
  51. data/test/regression/test_chart_axis08.rb +8 -9
  52. data/test/regression/test_chart_axis09.rb +8 -9
  53. data/test/regression/test_chart_axis10.rb +8 -9
  54. data/test/regression/test_chart_axis11.rb +8 -9
  55. data/test/regression/test_chart_axis12.rb +8 -9
  56. data/test/regression/test_chart_axis13.rb +8 -9
  57. data/test/regression/test_chart_axis14.rb +9 -10
  58. data/test/regression/test_chart_axis15.rb +9 -10
  59. data/test/regression/test_chart_axis16.rb +9 -10
  60. data/test/regression/test_chart_axis17.rb +6 -7
  61. data/test/regression/test_chart_axis18.rb +6 -7
  62. data/test/regression/test_chart_axis19.rb +6 -7
  63. data/test/regression/test_chart_axis20.rb +6 -7
  64. data/test/regression/test_chart_axis21.rb +6 -7
  65. data/test/regression/test_chart_axis22.rb +6 -7
  66. data/test/regression/test_chart_axis23.rb +6 -7
  67. data/test/regression/test_chart_axis24.rb +6 -7
  68. data/test/regression/test_chart_axis25.rb +6 -7
  69. data/test/regression/test_chart_axis26.rb +6 -7
  70. data/test/regression/test_chart_axis27.rb +6 -7
  71. data/test/regression/test_chart_axis28.rb +6 -7
  72. data/test/regression/test_chart_axis29.rb +6 -7
  73. data/test/regression/test_chart_axis30.rb +3 -7
  74. data/test/regression/test_chart_axis31.rb +3 -7
  75. data/test/regression/test_chart_axis32.rb +3 -7
  76. data/test/regression/test_chart_axis33.rb +6 -7
  77. data/test/regression/test_chart_axis34.rb +6 -7
  78. data/test/regression/test_chart_axis35.rb +6 -7
  79. data/test/regression/test_chart_axis36.rb +6 -7
  80. data/test/regression/test_chart_axis37.rb +6 -7
  81. data/test/regression/test_chart_axis38.rb +5 -10
  82. data/test/regression/test_chart_axis39.rb +6 -7
  83. data/test/regression/test_chart_bar01.rb +3 -3
  84. data/test/regression/test_chart_bar02.rb +11 -12
  85. data/test/regression/test_chart_bar03.rb +12 -13
  86. data/test/regression/test_chart_bar04.rb +12 -13
  87. data/test/regression/test_chart_bar05.rb +3 -7
  88. data/test/regression/test_chart_bar06.rb +9 -10
  89. data/test/regression/test_chart_bar07.rb +13 -14
  90. data/test/regression/test_chart_bar08.rb +3 -7
  91. data/test/regression/test_chart_bar09.rb +6 -7
  92. data/test/regression/test_chart_bar10.rb +6 -7
  93. data/test/regression/test_chart_bar11.rb +23 -25
  94. data/test/regression/test_chart_bar12.rb +3 -8
  95. data/test/regression/test_chart_bar13.rb +3 -8
  96. data/test/regression/test_chart_bar14.rb +10 -12
  97. data/test/regression/test_chart_bar15.rb +9 -11
  98. data/test/regression/test_chart_bar16.rb +8 -10
  99. data/test/regression/test_chart_bar17.rb +8 -10
  100. data/test/regression/test_chart_bar18.rb +17 -19
  101. data/test/regression/test_chart_bar19.rb +8 -10
  102. data/test/regression/test_chart_bar20.rb +8 -10
  103. data/test/regression/test_chart_bar21.rb +3 -7
  104. data/test/regression/test_chart_bar22.rb +8 -10
  105. data/test/regression/test_chart_bar23.rb +8 -10
  106. data/test/regression/test_chart_bar24.rb +9 -10
  107. data/test/regression/test_chart_blank01.rb +3 -3
  108. data/test/regression/test_chart_blank02.rb +3 -3
  109. data/test/regression/test_chart_blank03.rb +3 -3
  110. data/test/regression/test_chart_blank04.rb +3 -3
  111. data/test/regression/test_chart_blank05.rb +6 -8
  112. data/test/regression/test_chart_blank06.rb +3 -3
  113. data/test/regression/test_chart_chartarea01.rb +3 -3
  114. data/test/regression/test_chart_chartarea02.rb +3 -3
  115. data/test/regression/test_chart_chartarea03.rb +3 -3
  116. data/test/regression/test_chart_chartarea04.rb +6 -8
  117. data/test/regression/test_chart_chartarea05.rb +3 -3
  118. data/test/regression/test_chart_clustered01.rb +3 -3
  119. data/test/regression/test_chart_column01.rb +3 -7
  120. data/test/regression/test_chart_column02.rb +8 -9
  121. data/test/regression/test_chart_column03.rb +8 -9
  122. data/test/regression/test_chart_column04.rb +9 -10
  123. data/test/regression/test_chart_column05.rb +3 -3
  124. data/test/regression/test_chart_column06.rb +8 -9
  125. data/test/regression/test_chart_column07.rb +3 -7
  126. data/test/regression/test_chart_column08.rb +3 -7
  127. data/test/regression/test_chart_column09.rb +3 -7
  128. data/test/regression/test_chart_column10.rb +3 -7
  129. data/test/regression/test_chart_column11.rb +3 -7
  130. data/test/regression/test_chart_column12.rb +2 -10
  131. data/test/regression/test_chart_combined01.rb +3 -3
  132. data/test/regression/test_chart_combined02.rb +3 -3
  133. data/test/regression/test_chart_combined03.rb +3 -3
  134. data/test/regression/test_chart_combined04.rb +3 -3
  135. data/test/regression/test_chart_combined05.rb +3 -3
  136. data/test/regression/test_chart_combined06.rb +3 -3
  137. data/test/regression/test_chart_combined07.rb +3 -3
  138. data/test/regression/test_chart_combined08.rb +3 -3
  139. data/test/regression/test_chart_crossing01.rb +8 -9
  140. data/test/regression/test_chart_crossing02.rb +8 -9
  141. data/test/regression/test_chart_crossing03.rb +8 -9
  142. data/test/regression/test_chart_crossing04.rb +8 -9
  143. data/test/regression/test_chart_data_labels01.rb +3 -3
  144. data/test/regression/test_chart_data_labels02.rb +3 -3
  145. data/test/regression/test_chart_data_labels03.rb +3 -3
  146. data/test/regression/test_chart_data_labels04.rb +3 -3
  147. data/test/regression/test_chart_data_labels05.rb +3 -3
  148. data/test/regression/test_chart_data_labels06.rb +3 -3
  149. data/test/regression/test_chart_data_labels07.rb +3 -3
  150. data/test/regression/test_chart_data_labels08.rb +3 -3
  151. data/test/regression/test_chart_data_labels09.rb +3 -3
  152. data/test/regression/test_chart_data_labels10.rb +3 -3
  153. data/test/regression/test_chart_data_labels11.rb +3 -3
  154. data/test/regression/test_chart_data_labels12.rb +3 -3
  155. data/test/regression/test_chart_data_labels13.rb +3 -3
  156. data/test/regression/test_chart_data_labels14.rb +3 -3
  157. data/test/regression/test_chart_data_labels15.rb +3 -3
  158. data/test/regression/test_chart_data_labels16.rb +3 -3
  159. data/test/regression/test_chart_data_labels17.rb +3 -3
  160. data/test/regression/test_chart_data_labels18.rb +3 -3
  161. data/test/regression/test_chart_data_labels19.rb +3 -3
  162. data/test/regression/test_chart_data_labels20.rb +3 -3
  163. data/test/regression/test_chart_data_labels21.rb +3 -3
  164. data/test/regression/test_chart_data_labels22.rb +3 -3
  165. data/test/regression/test_chart_data_labels23.rb +3 -3
  166. data/test/regression/test_chart_data_labels24.rb +3 -3
  167. data/test/regression/test_chart_date01.rb +2 -6
  168. data/test/regression/test_chart_date02.rb +3 -3
  169. data/test/regression/test_chart_date03.rb +3 -3
  170. data/test/regression/test_chart_date04.rb +3 -3
  171. data/test/regression/test_chart_date05.rb +3 -3
  172. data/test/regression/test_chart_display_units01.rb +3 -3
  173. data/test/regression/test_chart_display_units02.rb +3 -3
  174. data/test/regression/test_chart_display_units03.rb +3 -3
  175. data/test/regression/test_chart_display_units04.rb +3 -3
  176. data/test/regression/test_chart_display_units05.rb +3 -3
  177. data/test/regression/test_chart_display_units06.rb +3 -3
  178. data/test/regression/test_chart_display_units07.rb +3 -3
  179. data/test/regression/test_chart_display_units08.rb +3 -3
  180. data/test/regression/test_chart_display_units09.rb +3 -3
  181. data/test/regression/test_chart_display_units10.rb +3 -3
  182. data/test/regression/test_chart_display_units11.rb +3 -3
  183. data/test/regression/test_chart_display_units12.rb +3 -3
  184. data/test/regression/test_chart_doughnut01.rb +3 -7
  185. data/test/regression/test_chart_doughnut02.rb +3 -7
  186. data/test/regression/test_chart_doughnut03.rb +3 -7
  187. data/test/regression/test_chart_doughnut04.rb +3 -7
  188. data/test/regression/test_chart_doughnut05.rb +3 -7
  189. data/test/regression/test_chart_doughnut06.rb +3 -7
  190. data/test/regression/test_chart_drop_lines01.rb +3 -3
  191. data/test/regression/test_chart_drop_lines02.rb +3 -3
  192. data/test/regression/test_chart_drop_lines03.rb +3 -3
  193. data/test/regression/test_chart_drop_lines04.rb +3 -3
  194. data/test/regression/test_chart_errorbars01.rb +3 -4
  195. data/test/regression/test_chart_errorbars02.rb +3 -4
  196. data/test/regression/test_chart_errorbars03.rb +3 -4
  197. data/test/regression/test_chart_errorbars04.rb +3 -4
  198. data/test/regression/test_chart_errorbars05.rb +3 -4
  199. data/test/regression/test_chart_errorbars06.rb +3 -4
  200. data/test/regression/test_chart_errorbars07.rb +6 -7
  201. data/test/regression/test_chart_errorbars08.rb +3 -7
  202. data/test/regression/test_chart_errorbars09.rb +3 -7
  203. data/test/regression/test_chart_errorbars10.rb +3 -7
  204. data/test/regression/test_chart_font01.rb +3 -3
  205. data/test/regression/test_chart_font02.rb +3 -3
  206. data/test/regression/test_chart_font03.rb +3 -3
  207. data/test/regression/test_chart_font04.rb +3 -3
  208. data/test/regression/test_chart_font05.rb +3 -3
  209. data/test/regression/test_chart_font06.rb +3 -3
  210. data/test/regression/test_chart_font07.rb +3 -3
  211. data/test/regression/test_chart_font08.rb +3 -3
  212. data/test/regression/test_chart_font09.rb +2 -6
  213. data/test/regression/test_chart_format01.rb +3 -3
  214. data/test/regression/test_chart_format02.rb +3 -3
  215. data/test/regression/test_chart_format03.rb +3 -3
  216. data/test/regression/test_chart_format04.rb +3 -3
  217. data/test/regression/test_chart_format05.rb +3 -3
  218. data/test/regression/test_chart_format06.rb +8 -10
  219. data/test/regression/test_chart_format07.rb +8 -10
  220. data/test/regression/test_chart_format08.rb +8 -10
  221. data/test/regression/test_chart_format09.rb +8 -10
  222. data/test/regression/test_chart_format10.rb +8 -10
  223. data/test/regression/test_chart_format11.rb +8 -10
  224. data/test/regression/test_chart_format12.rb +8 -10
  225. data/test/regression/test_chart_format13.rb +8 -10
  226. data/test/regression/test_chart_format14.rb +8 -10
  227. data/test/regression/test_chart_format15.rb +8 -10
  228. data/test/regression/test_chart_format16.rb +8 -10
  229. data/test/regression/test_chart_format17.rb +3 -4
  230. data/test/regression/test_chart_format18.rb +3 -4
  231. data/test/regression/test_chart_format19.rb +3 -4
  232. data/test/regression/test_chart_format20.rb +3 -4
  233. data/test/regression/test_chart_gap01.rb +3 -3
  234. data/test/regression/test_chart_gap02.rb +3 -3
  235. data/test/regression/test_chart_gap03.rb +3 -3
  236. data/test/regression/test_chart_gap04.rb +3 -3
  237. data/test/regression/test_chart_gap05.rb +3 -3
  238. data/test/regression/test_chart_gradient01.rb +3 -6
  239. data/test/regression/test_chart_gradient02.rb +3 -6
  240. data/test/regression/test_chart_gradient03.rb +3 -6
  241. data/test/regression/test_chart_gradient04.rb +3 -6
  242. data/test/regression/test_chart_gradient05.rb +3 -6
  243. data/test/regression/test_chart_gradient06.rb +3 -6
  244. data/test/regression/test_chart_gradient07.rb +3 -6
  245. data/test/regression/test_chart_gradient08.rb +3 -6
  246. data/test/regression/test_chart_gradient09.rb +3 -6
  247. data/test/regression/test_chart_gradient10.rb +3 -6
  248. data/test/regression/test_chart_gradient11.rb +3 -6
  249. data/test/regression/test_chart_gradient12.rb +3 -6
  250. data/test/regression/test_chart_gradient13.rb +3 -6
  251. data/test/regression/test_chart_gridlines01.rb +3 -6
  252. data/test/regression/test_chart_gridlines02.rb +3 -6
  253. data/test/regression/test_chart_gridlines03.rb +6 -8
  254. data/test/regression/test_chart_gridlines04.rb +3 -6
  255. data/test/regression/test_chart_gridlines05.rb +3 -6
  256. data/test/regression/test_chart_gridlines06.rb +3 -6
  257. data/test/regression/test_chart_gridlines07.rb +6 -8
  258. data/test/regression/test_chart_gridlines08.rb +3 -6
  259. data/test/regression/test_chart_gridlines09.rb +3 -6
  260. data/test/regression/test_chart_layout01.rb +3 -3
  261. data/test/regression/test_chart_layout02.rb +3 -3
  262. data/test/regression/test_chart_layout03.rb +3 -3
  263. data/test/regression/test_chart_layout04.rb +3 -3
  264. data/test/regression/test_chart_layout05.rb +3 -3
  265. data/test/regression/test_chart_layout06.rb +3 -3
  266. data/test/regression/test_chart_layout07.rb +3 -3
  267. data/test/regression/test_chart_layout08.rb +3 -3
  268. data/test/regression/test_chart_legend01.rb +3 -8
  269. data/test/regression/test_chart_legend02.rb +3 -8
  270. data/test/regression/test_chart_line01.rb +3 -3
  271. data/test/regression/test_chart_line02.rb +9 -10
  272. data/test/regression/test_chart_line03.rb +3 -3
  273. data/test/regression/test_chart_line04.rb +3 -3
  274. data/test/regression/test_chart_name01.rb +3 -6
  275. data/test/regression/test_chart_name02.rb +3 -6
  276. data/test/regression/test_chart_name03.rb +3 -6
  277. data/test/regression/test_chart_order01.rb +3 -6
  278. data/test/regression/test_chart_order02.rb +3 -6
  279. data/test/regression/test_chart_order03.rb +10 -12
  280. data/test/regression/test_chart_pie01.rb +3 -3
  281. data/test/regression/test_chart_pie02.rb +3 -3
  282. data/test/regression/test_chart_pie03.rb +3 -3
  283. data/test/regression/test_chart_pie04.rb +3 -3
  284. data/test/regression/test_chart_pie05.rb +3 -3
  285. data/test/regression/test_chart_points01.rb +3 -3
  286. data/test/regression/test_chart_points02.rb +3 -3
  287. data/test/regression/test_chart_points03.rb +3 -3
  288. data/test/regression/test_chart_points04.rb +3 -3
  289. data/test/regression/test_chart_points05.rb +3 -3
  290. data/test/regression/test_chart_points06.rb +3 -3
  291. data/test/regression/test_chart_radar01.rb +3 -3
  292. data/test/regression/test_chart_radar02.rb +3 -3
  293. data/test/regression/test_chart_radar03.rb +3 -3
  294. data/test/regression/test_chart_scatter01.rb +3 -3
  295. data/test/regression/test_chart_scatter02.rb +3 -3
  296. data/test/regression/test_chart_scatter03.rb +3 -3
  297. data/test/regression/test_chart_scatter04.rb +3 -3
  298. data/test/regression/test_chart_scatter05.rb +3 -3
  299. data/test/regression/test_chart_scatter06.rb +3 -3
  300. data/test/regression/test_chart_scatter07.rb +9 -10
  301. data/test/regression/test_chart_scatter08.rb +3 -3
  302. data/test/regression/test_chart_scatter09.rb +3 -3
  303. data/test/regression/test_chart_scatter10.rb +3 -3
  304. data/test/regression/test_chart_scatter11.rb +3 -3
  305. data/test/regression/test_chart_scatter12.rb +3 -3
  306. data/test/regression/test_chart_scatter13.rb +3 -3
  307. data/test/regression/test_chart_scatter14.rb +3 -3
  308. data/test/regression/test_chart_scatter15.rb +3 -3
  309. data/test/regression/test_chart_size01.rb +3 -3
  310. data/test/regression/test_chart_size02.rb +3 -3
  311. data/test/regression/test_chart_size03.rb +3 -3
  312. data/test/regression/test_chart_size04.rb +3 -3
  313. data/test/regression/test_chart_size05.rb +3 -3
  314. data/test/regression/test_chart_sparse01.rb +6 -9
  315. data/test/regression/test_chart_stock01.rb +6 -8
  316. data/test/regression/test_chart_stock02.rb +10 -12
  317. data/test/regression/test_chart_str01.rb +3 -8
  318. data/test/regression/test_chart_str02.rb +3 -8
  319. data/test/regression/test_chart_table01.rb +3 -6
  320. data/test/regression/test_chart_table02.rb +3 -6
  321. data/test/regression/test_chart_title01.rb +3 -8
  322. data/test/regression/test_chart_title02.rb +3 -8
  323. data/test/regression/test_chartsheet01.rb +3 -8
  324. data/test/regression/test_chartsheet02.rb +8 -10
  325. data/test/regression/test_chartsheet03.rb +8 -10
  326. data/test/regression/test_chartsheet04.rb +8 -10
  327. data/test/regression/test_chartsheet05.rb +8 -10
  328. data/test/regression/test_chartsheet06.rb +7 -13
  329. data/test/regression/test_chartsheet07.rb +16 -18
  330. data/test/regression/test_chartsheet08.rb +16 -18
  331. data/test/regression/test_chartsheet09.rb +8 -10
  332. data/test/regression/test_comment01.rb +3 -3
  333. data/test/regression/test_comment02.rb +3 -3
  334. data/test/regression/test_comment03.rb +6 -7
  335. data/test/regression/test_comment04.rb +6 -7
  336. data/test/regression/test_comment06.rb +6 -7
  337. data/test/regression/test_comment07.rb +6 -7
  338. data/test/regression/test_comment08.rb +6 -7
  339. data/test/regression/test_comment09.rb +6 -7
  340. data/test/regression/test_comment10.rb +6 -7
  341. data/test/regression/test_comment11.rb +6 -8
  342. data/test/regression/test_comment12.rb +3 -8
  343. data/test/regression/test_cond_format01.rb +6 -7
  344. data/test/regression/test_cond_format02.rb +6 -7
  345. data/test/regression/test_cond_format03.rb +6 -7
  346. data/test/regression/test_cond_format04.rb +6 -7
  347. data/test/regression/test_cond_format05.rb +6 -7
  348. data/test/regression/test_cond_format06.rb +6 -7
  349. data/test/regression/test_cond_format07.rb +6 -7
  350. data/test/regression/test_cond_format08.rb +6 -7
  351. data/test/regression/test_cond_format10.rb +6 -7
  352. data/test/regression/test_cond_format11.rb +6 -7
  353. data/test/regression/test_cond_format12.rb +6 -7
  354. data/test/regression/test_cond_format13.rb +6 -7
  355. data/test/regression/test_custom_colors01.rb +3 -3
  356. data/test/regression/test_data_validation01.rb +3 -3
  357. data/test/regression/test_data_validation02.rb +3 -3
  358. data/test/regression/test_data_validation03.rb +3 -3
  359. data/test/regression/test_data_validation04.rb +1 -5
  360. data/test/regression/test_data_validation05.rb +1 -5
  361. data/test/regression/test_date_1904_01.rb +3 -8
  362. data/test/regression/test_date_1904_02.rb +3 -8
  363. data/test/regression/test_date_examples01.rb +3 -3
  364. data/test/regression/test_default_format01.rb +2 -6
  365. data/test/regression/test_default_row01.rb +3 -3
  366. data/test/regression/test_default_row02.rb +3 -3
  367. data/test/regression/test_default_row03.rb +3 -3
  368. data/test/regression/test_default_row04.rb +3 -3
  369. data/test/regression/test_defined_name01.rb +10 -12
  370. data/test/regression/test_defined_name02.rb +10 -12
  371. data/test/regression/test_defined_name03.rb +10 -12
  372. data/test/regression/test_defined_name04.rb +2 -7
  373. data/test/regression/test_escapes01.rb +8 -10
  374. data/test/regression/test_escapes02.rb +8 -9
  375. data/test/regression/test_escapes03.rb +8 -9
  376. data/test/regression/test_escapes04.rb +8 -10
  377. data/test/regression/test_escapes05.rb +8 -10
  378. data/test/regression/test_escapes06.rb +3 -6
  379. data/test/regression/test_escapes07.rb +3 -6
  380. data/test/regression/test_escapes08.rb +3 -6
  381. data/test/regression/test_excel2003_style01.rb +3 -3
  382. data/test/regression/test_excel2003_style02.rb +3 -3
  383. data/test/regression/test_excel2003_style03.rb +3 -3
  384. data/test/regression/test_excel2003_style04.rb +3 -3
  385. data/test/regression/test_excel2003_style05.rb +3 -3
  386. data/test/regression/test_excel2003_style06.rb +3 -3
  387. data/test/regression/test_excel2003_style07.rb +3 -3
  388. data/test/regression/test_excel2003_style08.rb +3 -3
  389. data/test/regression/test_firstsheet01.rb +3 -8
  390. data/test/regression/test_fit_to_pages01.rb +12 -14
  391. data/test/regression/test_fit_to_pages02.rb +12 -14
  392. data/test/regression/test_fit_to_pages03.rb +12 -14
  393. data/test/regression/test_fit_to_pages04.rb +12 -14
  394. data/test/regression/test_fit_to_pages05.rb +12 -14
  395. data/test/regression/test_format01.rb +3 -3
  396. data/test/regression/test_format02.rb +3 -3
  397. data/test/regression/test_format03.rb +3 -3
  398. data/test/regression/test_format04.rb +3 -3
  399. data/test/regression/test_format05.rb +3 -3
  400. data/test/regression/test_format11.rb +3 -3
  401. data/test/regression/test_format12.rb +3 -3
  402. data/test/regression/test_formula_results01.rb +3 -3
  403. data/test/regression/test_gridlines01.rb +12 -14
  404. data/test/regression/test_header01.rb +3 -3
  405. data/test/regression/test_header02.rb +3 -3
  406. data/test/regression/test_header03.rb +3 -3
  407. data/test/regression/test_header_image01.rb +3 -3
  408. data/test/regression/test_header_image02.rb +3 -3
  409. data/test/regression/test_header_image03.rb +3 -3
  410. data/test/regression/test_header_image04.rb +3 -3
  411. data/test/regression/test_header_image05.rb +3 -3
  412. data/test/regression/test_header_image06.rb +3 -3
  413. data/test/regression/test_header_image07.rb +3 -3
  414. data/test/regression/test_header_image08.rb +3 -3
  415. data/test/regression/test_header_image09.rb +8 -12
  416. data/test/regression/test_header_image10.rb +3 -3
  417. data/test/regression/test_header_image11.rb +3 -3
  418. data/test/regression/test_header_image12.rb +3 -3
  419. data/test/regression/test_header_image13.rb +3 -3
  420. data/test/regression/test_header_image14.rb +3 -3
  421. data/test/regression/test_hide01.rb +3 -8
  422. data/test/regression/test_hyperlink01.rb +3 -3
  423. data/test/regression/test_hyperlink02.rb +3 -3
  424. data/test/regression/test_hyperlink03.rb +3 -3
  425. data/test/regression/test_hyperlink04.rb +3 -3
  426. data/test/regression/test_hyperlink05.rb +3 -3
  427. data/test/regression/test_hyperlink06.rb +3 -3
  428. data/test/regression/test_hyperlink07.rb +2 -6
  429. data/test/regression/test_hyperlink08.rb +3 -3
  430. data/test/regression/test_hyperlink09.rb +3 -3
  431. data/test/regression/test_hyperlink10.rb +3 -3
  432. data/test/regression/test_hyperlink11.rb +3 -3
  433. data/test/regression/test_hyperlink12.rb +3 -3
  434. data/test/regression/test_hyperlink13.rb +3 -3
  435. data/test/regression/test_hyperlink14.rb +3 -3
  436. data/test/regression/test_hyperlink15.rb +3 -3
  437. data/test/regression/test_hyperlink16.rb +3 -3
  438. data/test/regression/test_hyperlink17.rb +3 -3
  439. data/test/regression/test_hyperlink18.rb +3 -3
  440. data/test/regression/test_hyperlink20.rb +3 -3
  441. data/test/regression/test_hyperlink21.rb +3 -3
  442. data/test/regression/test_image01.rb +3 -3
  443. data/test/regression/test_image02.rb +3 -3
  444. data/test/regression/test_image03.rb +3 -3
  445. data/test/regression/test_image04.rb +3 -3
  446. data/test/regression/test_image05.rb +3 -3
  447. data/test/regression/test_image06.rb +3 -3
  448. data/test/regression/test_image07.rb +3 -3
  449. data/test/regression/test_image08.rb +3 -3
  450. data/test/regression/test_image09.rb +3 -3
  451. data/test/regression/test_image10.rb +3 -3
  452. data/test/regression/test_image11.rb +3 -3
  453. data/test/regression/test_image12.rb +3 -3
  454. data/test/regression/test_image13.rb +3 -3
  455. data/test/regression/test_image14.rb +3 -3
  456. data/test/regression/test_image15.rb +3 -3
  457. data/test/regression/test_image16.rb +3 -3
  458. data/test/regression/test_image17.rb +2 -6
  459. data/test/regression/test_image18.rb +3 -3
  460. data/test/regression/test_image19.rb +3 -3
  461. data/test/regression/test_image22.rb +3 -3
  462. data/test/regression/test_image23.rb +3 -3
  463. data/test/regression/test_image24.rb +3 -3
  464. data/test/regression/test_image25.rb +3 -3
  465. data/test/regression/test_image26.rb +3 -3
  466. data/test/regression/test_image27.rb +3 -3
  467. data/test/regression/test_landscape01.rb +3 -3
  468. data/test/regression/test_macro01.rb +3 -3
  469. data/test/regression/test_merge_cells01.rb +2 -6
  470. data/test/regression/test_merge_range01.rb +3 -6
  471. data/test/regression/test_merge_range02.rb +3 -6
  472. data/test/regression/test_merge_range03.rb +3 -6
  473. data/test/regression/test_merge_range04.rb +3 -6
  474. data/test/regression/test_merge_range05.rb +3 -6
  475. data/test/regression/test_outline01.rb +12 -14
  476. data/test/regression/test_outline02.rb +12 -14
  477. data/test/regression/test_outline03.rb +12 -14
  478. data/test/regression/test_outline04.rb +12 -14
  479. data/test/regression/test_outline05.rb +12 -14
  480. data/test/regression/test_outline06.rb +12 -14
  481. data/test/regression/test_page_breaks01.rb +12 -14
  482. data/test/regression/test_page_breaks02.rb +12 -14
  483. data/test/regression/test_page_breaks03.rb +12 -14
  484. data/test/regression/test_page_breaks04.rb +12 -14
  485. data/test/regression/test_page_breaks05.rb +12 -14
  486. data/test/regression/test_page_breaks06.rb +12 -14
  487. data/test/regression/test_page_view01.rb +12 -14
  488. data/test/regression/test_panes01.rb +3 -8
  489. data/test/regression/test_print_across01.rb +12 -14
  490. data/test/regression/test_print_area01.rb +12 -14
  491. data/test/regression/test_print_area02.rb +12 -14
  492. data/test/regression/test_print_area03.rb +12 -14
  493. data/test/regression/test_print_area04.rb +12 -14
  494. data/test/regression/test_print_area05.rb +12 -14
  495. data/test/regression/test_print_area06.rb +12 -14
  496. data/test/regression/test_print_area07.rb +12 -14
  497. data/test/regression/test_print_options01.rb +12 -14
  498. data/test/regression/test_print_options02.rb +12 -14
  499. data/test/regression/test_print_options03.rb +12 -14
  500. data/test/regression/test_print_options04.rb +12 -14
  501. data/test/regression/test_print_options05.rb +12 -14
  502. data/test/regression/test_print_options06.rb +12 -14
  503. data/test/regression/test_print_options07.rb +3 -5
  504. data/test/regression/test_print_scale01.rb +12 -14
  505. data/test/regression/test_print_scale02.rb +12 -14
  506. data/test/regression/test_properties01.rb +6 -7
  507. data/test/regression/test_protect01.rb +3 -3
  508. data/test/regression/test_protect02.rb +3 -3
  509. data/test/regression/test_protect03.rb +3 -3
  510. data/test/regression/test_quote_name01.rb +3 -3
  511. data/test/regression/test_quote_name03.rb +3 -3
  512. data/test/regression/test_quote_name04.rb +3 -3
  513. data/test/regression/test_repeat01.rb +12 -14
  514. data/test/regression/test_repeat02.rb +12 -14
  515. data/test/regression/test_repeat03.rb +12 -14
  516. data/test/regression/test_repeat04.rb +12 -14
  517. data/test/regression/test_repeat05.rb +15 -17
  518. data/test/regression/test_rich_string01.rb +3 -3
  519. data/test/regression/test_rich_string02.rb +3 -3
  520. data/test/regression/test_rich_string03.rb +3 -3
  521. data/test/regression/test_rich_string04.rb +3 -3
  522. data/test/regression/test_rich_string05.rb +3 -3
  523. data/test/regression/test_rich_string06.rb +3 -3
  524. data/test/regression/test_rich_string07.rb +3 -3
  525. data/test/regression/test_rich_string08.rb +3 -3
  526. data/test/regression/test_rich_string09.rb +3 -3
  527. data/test/regression/test_rich_string10.rb +3 -3
  528. data/test/regression/test_rich_string11.rb +3 -3
  529. data/test/regression/test_rich_string12.rb +3 -3
  530. data/test/regression/test_row_col_format01.rb +3 -3
  531. data/test/regression/test_row_col_format02.rb +3 -3
  532. data/test/regression/test_row_col_format03.rb +3 -3
  533. data/test/regression/test_row_col_format04.rb +3 -3
  534. data/test/regression/test_row_col_format05.rb +3 -3
  535. data/test/regression/test_row_col_format06.rb +3 -3
  536. data/test/regression/test_row_col_format07.rb +3 -3
  537. data/test/regression/test_row_col_format08.rb +3 -3
  538. data/test/regression/test_row_col_format09.rb +3 -3
  539. data/test/regression/test_row_col_format10.rb +3 -3
  540. data/test/regression/test_row_col_format11.rb +3 -3
  541. data/test/regression/test_row_col_format12.rb +3 -3
  542. data/test/regression/test_row_col_format13.rb +3 -3
  543. data/test/regression/test_row_col_format14.rb +3 -3
  544. data/test/regression/test_selection01.rb +3 -3
  545. data/test/regression/test_selection02.rb +3 -3
  546. data/test/regression/test_set_column01.rb +3 -3
  547. data/test/regression/test_set_column02.rb +3 -3
  548. data/test/regression/test_set_column03.rb +2 -6
  549. data/test/regression/test_set_column04.rb +3 -3
  550. data/test/regression/test_set_column05.rb +3 -3
  551. data/test/regression/test_set_column06.rb +3 -3
  552. data/test/regression/test_set_column07.rb +3 -3
  553. data/test/regression/test_set_column08.rb +3 -3
  554. data/test/regression/test_set_column09.rb +3 -3
  555. data/test/regression/test_set_print_scale01.rb +3 -3
  556. data/test/regression/test_set_start_page01.rb +3 -3
  557. data/test/regression/test_set_start_page02.rb +3 -3
  558. data/test/regression/test_set_start_page03.rb +3 -3
  559. data/test/regression/test_shape01.rb +3 -3
  560. data/test/regression/test_shape02.rb +3 -3
  561. data/test/regression/test_shape03.rb +3 -3
  562. data/test/regression/test_shape04.rb +3 -3
  563. data/test/regression/test_shape_connect01.rb +3 -3
  564. data/test/regression/test_shape_connect02.rb +3 -3
  565. data/test/regression/test_shape_connect03.rb +3 -3
  566. data/test/regression/test_shape_connect04.rb +3 -3
  567. data/test/regression/test_shape_scale01.rb +12 -14
  568. data/test/regression/test_shape_stencil01.rb +3 -8
  569. data/test/regression/test_shared_strings01.rb +6 -8
  570. data/test/regression/test_shared_strings02.rb +6 -8
  571. data/test/regression/test_shared_strings_encoding.rb +0 -103
  572. data/test/regression/test_simple01.rb +3 -3
  573. data/test/regression/test_simple02.rb +3 -3
  574. data/test/regression/test_simple03.rb +3 -3
  575. data/test/regression/test_simple04.rb +3 -3
  576. data/test/regression/test_simple05.rb +3 -3
  577. data/test/regression/test_tab_color01.rb +2 -11
  578. data/test/regression/test_table01.rb +3 -3
  579. data/test/regression/test_table02.rb +3 -3
  580. data/test/regression/test_table03.rb +3 -3
  581. data/test/regression/test_table04.rb +3 -3
  582. data/test/regression/test_table05.rb +3 -3
  583. data/test/regression/test_table06.rb +3 -3
  584. data/test/regression/test_table07.rb +3 -3
  585. data/test/regression/test_table08.rb +3 -3
  586. data/test/regression/test_table09.rb +3 -3
  587. data/test/regression/test_table10.rb +3 -3
  588. data/test/regression/test_table11.rb +3 -3
  589. data/test/regression/test_table12.rb +3 -3
  590. data/test/regression/test_table13.rb +3 -3
  591. data/test/regression/test_table14.rb +3 -3
  592. data/test/regression/test_table15.rb +3 -3
  593. data/test/regression/test_table16.rb +3 -3
  594. data/test/regression/test_table17.rb +3 -3
  595. data/test/regression/test_tutorial01.rb +3 -3
  596. data/test/regression/test_tutorial02.rb +3 -3
  597. data/test/regression/test_tutorial03.rb +3 -3
  598. data/test/regression/test_urls_as_strings.rb +3 -3
  599. data/test/regression/test_utf8_01.rb +3 -3
  600. data/test/regression/test_utf8_03.rb +3 -3
  601. data/test/regression/test_utf8_04.rb +3 -3
  602. data/test/regression/test_utf8_05.rb +3 -3
  603. data/test/regression/test_utf8_06.rb +3 -3
  604. data/test/regression/test_utf8_07.rb +3 -3
  605. data/test/regression/test_utf8_08.rb +3 -3
  606. data/test/regression/test_utf8_09.rb +2 -6
  607. data/test/regression/test_utf8_10.rb +3 -3
  608. data/test/regression/test_vml01.rb +3 -3
  609. data/test/regression/test_vml02.rb +3 -3
  610. data/test/regression/test_vml03.rb +3 -3
  611. data/test/regression/xlsx_files/urls_as_strings.xlsx +0 -0
  612. data/test/run_test.rb +9 -0
  613. data/test/test_example_match.rb +199 -133
  614. data/test/test_xml_writer_simple.rb +3 -3
  615. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 653c8e697dbe8468dd60f4cde55e69a2454ce80192b455e7bb0c88b385aadce0
4
- data.tar.gz: 75777d4a17597792871a0b78981e3b359b9113dc749ff7e495b80bf3812b232d
3
+ metadata.gz: ee225c252867f895e976e92e0cf2d1fa0617c8d1ab08277dced0f8c53037f0ae
4
+ data.tar.gz: 846527548749de579fc47f7cdd0df9826032fcb1b15cd500c441e6ffd339c3fa
5
5
  SHA512:
6
- metadata.gz: 6fc85d45b48b49b1a75a06b53c06a53bf1eb3b03dee67318e88f2a78248b3d75290d82920f41cc28327e676f6bb1c0a4742b816195fafd60f9817fbe7d830aa7
7
- data.tar.gz: 934303155838fc8008fa1e560d64d111fccd954b1006744645139124f8e2c403e9aa9ee31fd29e98b0ec2682069ea6293e46fcbe5146c5ac39d1e8dbdea07c8c
6
+ metadata.gz: 89fe866dcb96df87a917ddf9ef666d5583c5ece4c20424020fffbf55a648e1cbc8fa9cd6c6acd25e979528108c653414879fd020533e20740f7024c1a4678e69
7
+ data.tar.gz: e065e79287b82fe2b423cf119c008d92dc4c7f982acf1d98a4feb3da1d1ead8d8f8a8cc3c40e62162cf6315408875806366eeb6b058cd65f64197492cf0fe0bb
data/.gitignore CHANGED
@@ -1,4 +1,7 @@
1
1
  TAGS
2
+ GPATH
3
+ GRTAGS
4
+ GTAGS
2
5
  *.gem
3
6
  .bundle
4
7
  .config
data/Changes CHANGED
@@ -1,6 +1,21 @@
1
1
  Change history of write_xlsx rubygem.
2
2
 
3
- 2018-04-29 v0.85.3
3
+ 2020-09-07 v0.85.9
4
+ apply pull-request #59 and #60
5
+
6
+ 2020-09-03 v0.85.8
7
+ apply pull-request #58 and #52
8
+
9
+ 2019-06-20 v0.85.7
10
+ apply pull-request #26
11
+
12
+ 2019-02-10 v0.85.6
13
+ Fix work well in ms windows.
14
+
15
+ 2018-04-29 v0.85.5
16
+ Added option to store hyperlink strings as string (strings_as_urls: false).
17
+
18
+ 2018-04-29 v0.85.4
4
19
  Added option to store hyperlink strings as string (urls_as_strings).
5
20
 
6
21
  2018-01-07 v0.85.3
@@ -2631,7 +2631,7 @@ def write_custom_error_base(tag, values, data)
2631
2631
  end
2632
2632
 
2633
2633
  def write_num_ref_or_lit(values, data)
2634
- if values =~ /^=/ # '=Sheet1!$A$1:$A$5'
2634
+ if values.to_s =~ /^=/ # '=Sheet1!$A$1:$A$5'
2635
2635
  write_num_ref(values, data, 'num')
2636
2636
  else # [1, 2, 3]
2637
2637
  write_num_lit(values)
@@ -45,7 +45,7 @@ def ascii_only?
45
45
 
46
46
  unless File.respond_to?(:binread)
47
47
  def File.binread(file) #:nodoc:
48
- File.open(file,"rb") { |f| f.read }
48
+ File.open(file,"rb:utf-8:utf-8") { |f| f.read }
49
49
  end
50
50
  end
51
51
 
@@ -287,11 +287,10 @@ def set_format_properties(*properties) # :nodoc:
287
287
 
288
288
  # Create a sub to set the property.
289
289
  if value.respond_to?(:to_str) || !value.respond_to?(:+)
290
- s = "set_#{key}('#{value}')"
290
+ send("set_#{key}", value.to_s)
291
291
  else
292
- s = "set_#{key}(#{value})"
292
+ send("set_#{key}", value)
293
293
  end
294
- eval s
295
294
  end
296
295
  end
297
296
  end
@@ -306,7 +306,7 @@ def range_start_cell_for_conditional_formatting(*args) # :nodoc:
306
306
 
307
307
  def row_col_param_for_conditional_formatting(*args)
308
308
  # Check for a cell reference in A1 notation and substitute row and column
309
- if args[0] =~ /^\D/
309
+ if args[0].to_s =~ /^\D/
310
310
  # Check for a user defined multiple range like B3:K6,B8:K11.
311
311
  user_range = args[0].sub(/^=/, '').gsub(/\s*,\s*/, ' ').gsub(/\$/, '') if args[0] =~ /,/
312
312
  end
@@ -383,7 +383,7 @@ def check_conditional_formatting_parameters(param) # :nodoc:
383
383
  end
384
384
 
385
385
  def convert_date_time_if_required(val)
386
- if val =~ /T/
386
+ if val.to_s =~ /T/
387
387
  date_time = convert_date_time(val)
388
388
  raise "Invalid date/time value '#{val}' in conditional_formatting()" unless date_time
389
389
  date_time
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require 'write_xlsx/package/xml_writer_simple'
3
4
  require 'write_xlsx/utility'
4
5
 
@@ -8,29 +9,33 @@ class SharedStrings
8
9
 
9
10
  include Writexlsx::Utility
10
11
 
12
+ PRESERVE_SPACE_ATTRIBUTES = ['xml:space', 'preserve'].freeze
13
+
11
14
  def initialize
12
- @writer = Package::XMLWriterSimple.new
13
- @strings = [] # string table
14
- @count = {} # => count
15
+ @writer = Package::XMLWriterSimple.new
16
+ @strings = [] # string table
17
+ @strings_index = {} # string table index
18
+ @count = 0 # count
15
19
  end
16
20
 
17
21
  def index(string, params = {})
18
22
  add(string) unless params[:only_query]
19
- @strings.index(string)
23
+ @strings_index[string]
20
24
  end
21
25
 
22
26
  def add(string)
23
- str = string.dup
24
- if @count[str]
25
- @count[str] += 1
26
- else
27
+ unless @strings_index[string]
28
+ # Only first time the string will be append to list
29
+ # next time we only check and not #dup it
30
+ str = string.dup.freeze
27
31
  @strings << str
28
- @count[str] = 1
32
+ @strings_index[str] = @strings.size - 1
29
33
  end
34
+ @count += 1
30
35
  end
31
36
 
32
37
  def string(index)
33
- @strings[index].dup
38
+ @strings[index]
34
39
  end
35
40
 
36
41
  def empty?
@@ -77,7 +82,6 @@ def write_sst_strings
77
82
  # Write the <si> element.
78
83
  #
79
84
  def write_si(string)
80
- string = string.dup
81
85
  attributes = []
82
86
 
83
87
  # Excel escapes control characters with _xHHHH_ and also escapes any
@@ -100,7 +104,7 @@ def write_si(string)
100
104
  end
101
105
 
102
106
  # Add attribute to preserve leading or trailing whitespace.
103
- attributes << ['xml:space', 'preserve'] if string =~ /\A\s|\s\Z/
107
+ attributes << PRESERVE_SPACE_ATTRIBUTES if string =~ /\A\s|\s\Z/
104
108
 
105
109
  # Write any rich strings without further tags.
106
110
  if string =~ %r{^<r>} && string =~ %r{</r>$}
@@ -120,7 +124,7 @@ def add_c2_c3(string)
120
124
  end
121
125
 
122
126
  def total_count
123
- @count.values.inject(0) { |sum, count| sum += count }
127
+ @count
124
128
  end
125
129
 
126
130
  def unique_count
@@ -49,7 +49,7 @@ def set_style_properties(xf_formats, palette, font_count, num_format_count, bord
49
49
  # based on the default or user defined values in the Workbook palette.
50
50
  #
51
51
  def palette_color(index)
52
- if index =~ /^#([0-9A-F]{6})$/i
52
+ if index.to_s =~ /^#([0-9A-F]{6})$/i
53
53
  "FF#{$1.upcase}"
54
54
  else
55
55
  "FF#{super(index)}"
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  #
3
4
  # XMLWriterSimple
4
5
  #
@@ -29,10 +30,9 @@ def tag_elements(tag, attributes = [])
29
30
  end
30
31
 
31
32
  def tag_elements_str(tag, attributes = [])
32
- str = ''
33
- str << start_tag_str(tag, attributes)
34
- str << yield
35
- str << end_tag_str(tag)
33
+ str = start_tag_str(tag, attributes) +
34
+ yield +
35
+ end_tag_str(tag)
36
36
  end
37
37
 
38
38
  def start_tag(tag, attr = [])
@@ -65,7 +65,7 @@ def empty_tag_encoded_str(tag, attr = [])
65
65
  end
66
66
 
67
67
  def data_element(tag, data, attr = [])
68
- tag_elements(tag, attr) { io_write("#{escape_data(data)}") }
68
+ tag_elements(tag, attr) { io_write(escape_data(data)) }
69
69
  end
70
70
 
71
71
  #
@@ -92,7 +92,7 @@ def crlf
92
92
 
93
93
  def close
94
94
  if @filename
95
- File.open(@filename, "wb") { |f| f << string }
95
+ File.open(@filename, "wb:utf-8:utf-8") { |f| f << string }
96
96
  end
97
97
  @io.close
98
98
  end
@@ -118,7 +118,7 @@ def key_vals(attribute)
118
118
  end
119
119
 
120
120
  def escape_attributes(str = '')
121
- return str if !(str =~ /["&<>]/)
121
+ return str if !(str.to_s =~ /["&<>]/)
122
122
 
123
123
  str.
124
124
  gsub(/&/, "&amp;").
@@ -128,7 +128,7 @@ def escape_attributes(str = '')
128
128
  end
129
129
 
130
130
  def escape_data(str = '')
131
- if str =~ /[&<>]/
131
+ if str.to_s =~ /[&<>]/
132
132
  str.gsub(/&/, '&amp;').
133
133
  gsub(/</, '&lt;').
134
134
  gsub(/>/, '&gt;')
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require 'write_xlsx/col_name'
3
4
 
4
5
  module Writexlsx
@@ -243,7 +244,7 @@ def put_deprecate_message(method)
243
244
 
244
245
  # Check for a cell reference in A1 notation and substitute row and column
245
246
  def row_col_notation(args) # :nodoc:
246
- if args[0] =~ /^\D/
247
+ if args[0].to_s =~ /^\D/
247
248
  substitute_cellref(*args)
248
249
  else
249
250
  args
@@ -303,11 +304,12 @@ def write_color(writer, name, value) #:nodoc:
303
304
  writer.empty_tag('color', attributes)
304
305
  end
305
306
 
307
+ PERL_TRUE_VALUES = [false, nil, 0, "0", "", [], {}].freeze
306
308
  #
307
309
  # return perl's boolean result
308
310
  #
309
311
  def ptrue?(value)
310
- if [false, nil, 0, "0", "", [], {}].include?(value)
312
+ if PERL_TRUE_VALUES.include?(value)
311
313
  false
312
314
  else
313
315
  true
@@ -586,7 +588,7 @@ def process_workbook_options(*params)
586
588
  when 0
587
589
  [{}, {}]
588
590
  when 1 # one hash
589
- options_keys = [:tempdir, :date_1904, :optimization, :excel2003_style]
591
+ options_keys = [:tempdir, :date_1904, :optimization, :excel2003_style, :strings_to_urls]
590
592
 
591
593
  hash = params.first
592
594
  options = hash.reject{|k,v| !options_keys.include?(k)}
@@ -1 +1 @@
1
- WriteXLSX_VERSION = "0.85.4"
1
+ WriteXLSX_VERSION = "0.85.9"
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require 'write_xlsx/package/xml_writer_simple'
3
4
  require 'write_xlsx/package/packager'
4
5
  require 'write_xlsx/sheets'
@@ -926,7 +927,7 @@ def set_calc_mode(mode, calc_id = nil)
926
927
  #
927
928
  def set_custom_color(index, red = 0, green = 0, blue = 0)
928
929
  # Match a HTML #xxyyzz style parameter
929
- if red =~ /^#(\w\w)(\w\w)(\w\w)/
930
+ if red.to_s =~ /^#(\w\w)(\w\w)(\w\w)/
930
931
  red = $1.hex
931
932
  green = $2.hex
932
933
  blue = $3.hex
@@ -972,8 +973,9 @@ def date_1904? #:nodoc:
972
973
  # Add a string to the shared string table, if it isn't already there, and
973
974
  # return the string index.
974
975
  #
975
- def shared_string_index(str, params = {}) #:nodoc:
976
- @shared_strings.index(str, params)
976
+ EMPTY_HASH = {}.freeze
977
+ def shared_string_index(str) #:nodoc:
978
+ @shared_strings.index(str, EMPTY_HASH)
977
979
  end
978
980
 
979
981
  def str_unique # :nodoc:
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require 'write_xlsx/package/xml_writer_simple'
3
4
  require 'write_xlsx/package/button'
4
5
  require 'write_xlsx/colors'
@@ -720,7 +721,7 @@ def protect_default_settings # :nodoc:
720
721
  #
721
722
  def set_column(*args)
722
723
  # Check for a cell reference in A1 notation and substitute row and column
723
- if args[0] =~ /^\D/
724
+ if args[0].to_s =~ /^\D/
724
725
  row1, firstcol, row2, lastcol, *data = substitute_cellref(*args)
725
726
  else
726
727
  firstcol, lastcol, *data = args
@@ -2188,7 +2189,7 @@ def write_comment(*args)
2188
2189
  def write_number(*args)
2189
2190
  # Check for a cell reference in A1 notation and substitute row and column
2190
2191
  row, col, num, xf = row_col_notation(args)
2191
- raise WriteXLSXInsufficientArgumentError if [row, col, num].include?(nil)
2192
+ raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || num.nil?
2192
2193
 
2193
2194
  # Check that row and col are valid and store max and min values
2194
2195
  check_dimensions(row, col)
@@ -2230,13 +2231,13 @@ def write_string(*args)
2230
2231
  # Check for a cell reference in A1 notation and substitute row and column
2231
2232
  row, col, str, xf = row_col_notation(args)
2232
2233
  str &&= str.to_s
2233
- raise WriteXLSXInsufficientArgumentError if [row, col, str].include?(nil)
2234
+ raise WriteXLSXInsufficientArgumentError if row.nil? || col.nil? || str.nil?
2234
2235
 
2235
2236
  # Check that row and col are valid and store max and min values
2236
2237
  check_dimensions(row, col)
2237
2238
  store_row_col_max_min_values(row, col)
2238
2239
 
2239
- index = shared_string_index(str[0, STR_MAX])
2240
+ index = shared_string_index(str.length > STR_MAX ? str[0, STR_MAX] : str)
2240
2241
 
2241
2242
  store_data_to_table(StringCellData.new(self, row, col, index, xf))
2242
2243
  end
@@ -5810,7 +5811,7 @@ def excel2003_style? # :nodoc:
5810
5811
  # based on the default or user defined values in the Workbook palette.
5811
5812
  #
5812
5813
  def palette_color(index) #:nodoc:
5813
- if index =~ /^#([0-9A-F]{6})$/i
5814
+ if index.to_s =~ /^#([0-9A-F]{6})$/i
5814
5815
  "FF#{$1.upcase}"
5815
5816
  else
5816
5817
  "FF#{super(index)}"
@@ -5849,10 +5850,11 @@ def prepare_vml_objects(vml_data_id, vml_shape_id, vml_drawing_id, comment_id)
5849
5850
 
5850
5851
  # The VML o:idmap data id contains a comma separated range when there is
5851
5852
  # more than one 1024 block of comments, like this: data="1,2".
5853
+ data = "#{vml_data_id}"
5852
5854
  (1 .. num_comments_block).each do |i|
5853
- vml_data_id = "#{vml_data_id},#{vml_data_id + i}"
5855
+ data += ",#{vml_data_id + i}"
5854
5856
  end
5855
- @vml_data_id = vml_data_id
5857
+ @vml_data_id = data
5856
5858
  @vml_shape_id = vml_shape_id
5857
5859
  end
5858
5860
 
@@ -6098,7 +6100,7 @@ def parse_filter_tokens(expression, tokens) #:nodoc:
6098
6100
  # Special handling of "Top" filter expressions.
6099
6101
  if tokens[0] =~ /^top|bottom$/i
6100
6102
  value = tokens[1]
6101
- if (value =~ /\D/ or value.to_i < 1 or value.to_i > 500)
6103
+ if (value.to_s =~ /\D/ or value.to_i < 1 or value.to_i > 500)
6102
6104
  raise "The value '#{value}' in expression '#{expression}' " +
6103
6105
  "must be in the range 1 to 500"
6104
6106
  end
@@ -6127,7 +6129,7 @@ def parse_filter_tokens(expression, tokens) #:nodoc:
6127
6129
  end
6128
6130
 
6129
6131
  # Special handling for Blanks/NonBlanks.
6130
- if (token =~ /^blanks|nonblanks$/i)
6132
+ if (token.to_s =~ /^blanks|nonblanks$/i)
6131
6133
  # Only allow Equals or NotEqual in this context.
6132
6134
  if (operator != 2 and operator != 5)
6133
6135
  raise "The operator '#{tokens[1]}' in expression '#{expression}' " +
@@ -6155,7 +6157,7 @@ def parse_filter_tokens(expression, tokens) #:nodoc:
6155
6157
 
6156
6158
  # if the string token contains an Excel match character then change the
6157
6159
  # operator type to indicate a non "simple" equality.
6158
- if (operator == 2 and token =~ /[*?]/)
6160
+ if (operator == 2 and token.to_s =~ /[*?]/)
6159
6161
  operator = 22
6160
6162
  end
6161
6163
 
@@ -7509,8 +7511,8 @@ def calc_spans(data, row_num, span_min, span_max)
7509
7511
  # Add a string to the shared string table, if it isn't already there, and
7510
7512
  # return the string index.
7511
7513
  #
7512
- def shared_string_index(str, params = {}) #:nodoc:
7513
- @workbook.shared_string_index(str, params)
7514
+ def shared_string_index(str) #:nodoc:
7515
+ @workbook.shared_string_index(str)
7514
7516
  end
7515
7517
 
7516
7518
  #
@@ -7633,7 +7635,7 @@ def set_active_pane_and_cell_selections(row, col, top_row, left_col, active_cell
7633
7635
 
7634
7636
  def prepare_filter_column(col) # :nodoc:
7635
7637
  # Check for a column reference in A1 notation and substitute.
7636
- if col =~ /^\D/
7638
+ if col.to_s =~ /^\D/
7637
7639
  col_letter = col
7638
7640
 
7639
7641
  # Convert col ref to a cell ref and then to a col number.
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
 
3
4
  module Writexlsx
4
5
  class Worksheet
@@ -63,9 +64,10 @@ def data
63
64
  { :sst_id => token }
64
65
  end
65
66
 
67
+ TYPE_STR_ATTRS = ['t', 's'].freeze
66
68
  def write_cell
67
69
  attributes = cell_attributes
68
- attributes << ['t', 's']
70
+ attributes << TYPE_STR_ATTRS
69
71
  @worksheet.writer.tag_elements('c', attributes) do
70
72
  @worksheet.write_cell_value(token)
71
73
  end
@@ -282,7 +282,7 @@ def valid_criteria_type # :nodoc:
282
282
 
283
283
  def convert_date_time_value(key) # :nodoc:
284
284
  value = instance_variable_get("@#{key}")
285
- if value && value =~ /T/
285
+ if value && value.to_s =~ /T/
286
286
  date_time = convert_date_time(value)
287
287
  instance_variable_set("@#{key}", date_time) if date_time
288
288
  date_time
@@ -24,7 +24,7 @@ def initialize(url, str, tip)
24
24
  str ||= url.dup
25
25
 
26
26
  # Strip the mailto header.
27
- str.sub!(/^mailto:/, '')
27
+ normalized_str = str.sub(/^mailto:/, '')
28
28
 
29
29
  # Escape URL unless it looks already escaped.
30
30
  url = escape_url(url)
@@ -35,7 +35,7 @@ def initialize(url, str, tip)
35
35
  end
36
36
 
37
37
  @url = url
38
- @str = str
38
+ @str = normalized_str
39
39
  @url_str = nil
40
40
  @tip = tip
41
41
  end