caxlsx 3.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -11
  3. data/README.md +43 -16
  4. data/Rakefile +5 -11
  5. data/examples/generate.rb +3 -1
  6. data/lib/axlsx/content_type/abstract_content_type.rb +15 -10
  7. data/lib/axlsx/content_type/content_type.rb +8 -10
  8. data/lib/axlsx/content_type/default.rb +7 -6
  9. data/lib/axlsx/content_type/override.rb +6 -5
  10. data/lib/axlsx/doc_props/app.rb +96 -32
  11. data/lib/axlsx/doc_props/core.rb +9 -12
  12. data/lib/axlsx/drawing/area_chart.rb +16 -17
  13. data/lib/axlsx/drawing/area_series.rb +23 -18
  14. data/lib/axlsx/drawing/ax_data_source.rb +4 -7
  15. data/lib/axlsx/drawing/axes.rb +11 -10
  16. data/lib/axlsx/drawing/axis.rb +83 -36
  17. data/lib/axlsx/drawing/bar_3D_chart.rb +30 -21
  18. data/lib/axlsx/drawing/bar_chart.rb +29 -20
  19. data/lib/axlsx/drawing/bar_series.rb +23 -18
  20. data/lib/axlsx/drawing/bubble_chart.rb +9 -10
  21. data/lib/axlsx/drawing/bubble_series.rb +11 -12
  22. data/lib/axlsx/drawing/cat_axis.rb +38 -28
  23. data/lib/axlsx/drawing/chart.rb +52 -30
  24. data/lib/axlsx/drawing/d_lbls.rb +36 -32
  25. data/lib/axlsx/drawing/drawing.rb +61 -62
  26. data/lib/axlsx/drawing/graphic_frame.rb +6 -7
  27. data/lib/axlsx/drawing/hyperlink.rb +22 -14
  28. data/lib/axlsx/drawing/line_3D_chart.rb +15 -17
  29. data/lib/axlsx/drawing/line_chart.rb +16 -17
  30. data/lib/axlsx/drawing/line_series.rb +23 -18
  31. data/lib/axlsx/drawing/marker.rb +29 -16
  32. data/lib/axlsx/drawing/num_data.rb +13 -16
  33. data/lib/axlsx/drawing/num_data_source.rb +11 -13
  34. data/lib/axlsx/drawing/num_val.rb +10 -11
  35. data/lib/axlsx/drawing/one_cell_anchor.rb +16 -10
  36. data/lib/axlsx/drawing/pic.rb +68 -24
  37. data/lib/axlsx/drawing/picture_locking.rb +6 -7
  38. data/lib/axlsx/drawing/pie_3D_chart.rb +9 -12
  39. data/lib/axlsx/drawing/pie_chart.rb +36 -0
  40. data/lib/axlsx/drawing/pie_series.rb +26 -17
  41. data/lib/axlsx/drawing/scaling.rb +26 -13
  42. data/lib/axlsx/drawing/scatter_chart.rb +10 -11
  43. data/lib/axlsx/drawing/scatter_series.rb +17 -18
  44. data/lib/axlsx/drawing/ser_axis.rb +22 -19
  45. data/lib/axlsx/drawing/series.rb +14 -8
  46. data/lib/axlsx/drawing/series_title.rb +6 -6
  47. data/lib/axlsx/drawing/str_data.rb +10 -13
  48. data/lib/axlsx/drawing/str_val.rb +8 -9
  49. data/lib/axlsx/drawing/title.rb +23 -27
  50. data/lib/axlsx/drawing/two_cell_anchor.rb +9 -9
  51. data/lib/axlsx/drawing/val_axis.rb +7 -8
  52. data/lib/axlsx/drawing/view_3D.rb +38 -30
  53. data/lib/axlsx/drawing/vml_drawing.rb +19 -20
  54. data/lib/axlsx/drawing/vml_shape.rb +25 -26
  55. data/lib/axlsx/package.rb +134 -99
  56. data/lib/axlsx/rels/relationship.rb +42 -30
  57. data/lib/axlsx/rels/relationships.rb +9 -10
  58. data/lib/axlsx/stylesheet/border.rb +16 -8
  59. data/lib/axlsx/stylesheet/border_pr.rb +24 -12
  60. data/lib/axlsx/stylesheet/cell_alignment.rb +44 -21
  61. data/lib/axlsx/stylesheet/cell_protection.rb +13 -7
  62. data/lib/axlsx/stylesheet/cell_style.rb +36 -15
  63. data/lib/axlsx/stylesheet/color.rb +23 -14
  64. data/lib/axlsx/stylesheet/dxf.rb +36 -15
  65. data/lib/axlsx/stylesheet/fill.rb +7 -6
  66. data/lib/axlsx/stylesheet/font.rb +71 -22
  67. data/lib/axlsx/stylesheet/gradient_fill.rb +16 -10
  68. data/lib/axlsx/stylesheet/gradient_stop.rb +14 -6
  69. data/lib/axlsx/stylesheet/num_fmt.rb +15 -14
  70. data/lib/axlsx/stylesheet/pattern_fill.rb +20 -8
  71. data/lib/axlsx/stylesheet/styles.rb +167 -118
  72. data/lib/axlsx/stylesheet/table_style.rb +20 -10
  73. data/lib/axlsx/stylesheet/table_style_element.rb +16 -8
  74. data/lib/axlsx/stylesheet/table_styles.rb +16 -11
  75. data/lib/axlsx/stylesheet/theme.rb +163 -0
  76. data/lib/axlsx/stylesheet/xf.rb +78 -25
  77. data/lib/axlsx/util/accessors.rb +13 -11
  78. data/lib/axlsx/util/buffered_zip_output_stream.rb +64 -0
  79. data/lib/axlsx/util/constants.rb +133 -110
  80. data/lib/axlsx/util/mime_type_utils.rb +75 -5
  81. data/lib/axlsx/util/options_parser.rb +4 -3
  82. data/lib/axlsx/util/serialized_attributes.rb +47 -23
  83. data/lib/axlsx/util/simple_typed_list.rb +77 -64
  84. data/lib/axlsx/util/storage.rb +38 -41
  85. data/lib/axlsx/util/uri_utils.rb +70 -0
  86. data/lib/axlsx/util/validators.rb +111 -48
  87. data/lib/axlsx/util/zip_command.rb +10 -12
  88. data/lib/axlsx/version.rb +3 -2
  89. data/lib/axlsx/workbook/defined_name.rb +13 -9
  90. data/lib/axlsx/workbook/defined_names.rb +5 -4
  91. data/lib/axlsx/workbook/shared_strings_table.rb +13 -14
  92. data/lib/axlsx/workbook/workbook.rb +152 -120
  93. data/lib/axlsx/workbook/workbook_view.rb +9 -12
  94. data/lib/axlsx/workbook/workbook_views.rb +5 -5
  95. data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +87 -15
  96. data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +16 -10
  97. data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +28 -25
  98. data/lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb +51 -0
  99. data/lib/axlsx/workbook/worksheet/auto_filter/sort_state.rb +54 -0
  100. data/lib/axlsx/workbook/worksheet/border_creator.rb +34 -29
  101. data/lib/axlsx/workbook/worksheet/break.rb +4 -5
  102. data/lib/axlsx/workbook/worksheet/cell.rb +125 -78
  103. data/lib/axlsx/workbook/worksheet/cell_serializer.rb +33 -29
  104. data/lib/axlsx/workbook/worksheet/cfvo.rb +13 -5
  105. data/lib/axlsx/workbook/worksheet/cfvos.rb +5 -5
  106. data/lib/axlsx/workbook/worksheet/col.rb +32 -19
  107. data/lib/axlsx/workbook/worksheet/col_breaks.rb +9 -8
  108. data/lib/axlsx/workbook/worksheet/color_scale.rb +16 -16
  109. data/lib/axlsx/workbook/worksheet/cols.rb +10 -8
  110. data/lib/axlsx/workbook/worksheet/comment.rb +14 -13
  111. data/lib/axlsx/workbook/worksheet/comments.rb +11 -13
  112. data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +19 -9
  113. data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +75 -22
  114. data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +8 -8
  115. data/lib/axlsx/workbook/worksheet/data_bar.rb +29 -30
  116. data/lib/axlsx/workbook/worksheet/data_validation.rb +73 -33
  117. data/lib/axlsx/workbook/worksheet/data_validations.rb +8 -9
  118. data/lib/axlsx/workbook/worksheet/date_time_converter.rb +8 -8
  119. data/lib/axlsx/workbook/worksheet/dimension.rb +10 -7
  120. data/lib/axlsx/workbook/worksheet/header_footer.rb +5 -4
  121. data/lib/axlsx/workbook/worksheet/icon_set.rb +40 -12
  122. data/lib/axlsx/workbook/worksheet/merged_cells.rb +11 -11
  123. data/lib/axlsx/workbook/worksheet/outline_pr.rb +7 -4
  124. data/lib/axlsx/workbook/worksheet/page_margins.rb +41 -13
  125. data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +7 -6
  126. data/lib/axlsx/workbook/worksheet/page_setup.rb +153 -131
  127. data/lib/axlsx/workbook/worksheet/pane.rb +34 -26
  128. data/lib/axlsx/workbook/worksheet/pivot_table.rb +78 -29
  129. data/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +12 -13
  130. data/lib/axlsx/workbook/worksheet/pivot_tables.rb +6 -5
  131. data/lib/axlsx/workbook/worksheet/print_options.rb +4 -2
  132. data/lib/axlsx/workbook/worksheet/protected_range.rb +6 -5
  133. data/lib/axlsx/workbook/worksheet/protected_ranges.rb +13 -11
  134. data/lib/axlsx/workbook/worksheet/rich_text.rb +6 -6
  135. data/lib/axlsx/workbook/worksheet/rich_text_run.rb +66 -28
  136. data/lib/axlsx/workbook/worksheet/row.rb +34 -23
  137. data/lib/axlsx/workbook/worksheet/row_breaks.rb +9 -8
  138. data/lib/axlsx/workbook/worksheet/selection.rb +22 -16
  139. data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +11 -7
  140. data/lib/axlsx/workbook/worksheet/sheet_data.rb +7 -7
  141. data/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +23 -19
  142. data/lib/axlsx/workbook/worksheet/sheet_pr.rb +12 -8
  143. data/lib/axlsx/workbook/worksheet/sheet_protection.rb +22 -21
  144. data/lib/axlsx/workbook/worksheet/sheet_view.rb +71 -55
  145. data/lib/axlsx/workbook/worksheet/table.rb +13 -13
  146. data/lib/axlsx/workbook/worksheet/table_style_info.rb +8 -6
  147. data/lib/axlsx/workbook/worksheet/tables.rb +8 -6
  148. data/lib/axlsx/workbook/worksheet/worksheet.rb +120 -79
  149. data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +13 -11
  150. data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +11 -4
  151. data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +12 -10
  152. data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +9 -7
  153. data/lib/axlsx.rb +120 -60
  154. data/lib/caxlsx.rb +3 -2
  155. metadata +42 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f5803740b82493118fd7fe6787c90dd0eb8e2f7908736597026d03c4255597b
4
- data.tar.gz: 3bf010de6171b2862cd27ea12df265162071801b0cac7172cee4d1629e856835
3
+ metadata.gz: 4788f1b6fd206e4e4727a10114249a6ddd0eb8e3d3eed2d1f74e43e6c415b1fc
4
+ data.tar.gz: c8883c5e7ed0f029cb3b09f3741f724bb2ebe823c6084524e9ba72468f6291ef
5
5
  SHA512:
6
- metadata.gz: 40af150a59e4aacb3f1d385117d0c21b1b2d8ca3c36e12592f23464b35270ac07af826c2494c9922510603e96933de82dafb4819b8ac31b892c7ce842eb190cc
7
- data.tar.gz: bd16de0493f11a225fd7e376cdce5b10433f253431e2d00f9ecfeca464f96336499d35806781de77ad5c1dad62a63bb2545deb7e00cfef6fc0a4a1f0657103e1
6
+ metadata.gz: d8c5703e775090e2b1a9fec353f67e713d83ac21d6bfe980d45fc876b5506ca849ee37d8e6588b759c7434c66d444f15f90c9da6e4026042a43fc7a5910de831
7
+ data.tar.gz: 79e6e3341fdff59db93bc8534d77edaf2817305ab3053d0daaa66a2b3a8323f60ef07a8b49a6301d2985dc818795233c7879500f45b61b2296a454adb7df9e47
data/CHANGELOG.md CHANGED
@@ -2,6 +2,82 @@ CHANGELOG
2
2
  ---------
3
3
  - **Unreleased**
4
4
 
5
+ - **June.09.26**: 4.5.0
6
+ - [PR #527](https://github.com/caxlsx/caxlsx/pull/527) Fix PivotTable countNums subtotal label never applied. Solves [Issue #526](https://github.com/caxlsx/caxlsx/issues/526)
7
+ - [PR #522](https://github.com/caxlsx/caxlsx/pull/522) Allow custom name for pivot table data fields via :name option
8
+ - [PR #520](https://github.com/caxlsx/caxlsx/pull/520) Add `use_auto_formatting` and `apply_width_height_formats` accessors to `PivotTable`
9
+ - [PR #517](https://github.com/caxlsx/caxlsx/pull/517) Fix invalid XML when pivot table has both `columns` and multiple `data` fields configured. Solves [Issue #414](https://github.com/caxlsx/caxlsx/issues/414)
10
+
11
+ - **March.23.26**: 4.4.2
12
+ - [PR #510](https://github.com/caxlsx/caxlsx/pull/510) Add configurable `major_tick_mark` and `minor_tick_mark` attributes to chart axes
13
+ - [PR #495](https://github.com/caxlsx/caxlsx/pull/495) Make worksheet name length validation optional
14
+ - [PR #496](https://github.com/caxlsx/caxlsx/pull/496) Fix FrozenError when passing in a frozen hash to add_style
15
+ - [PR #500](https://github.com/caxlsx/caxlsx/pull/500) Full Ruby 4.0 compatibility
16
+ - [PR #504](https://github.com/caxlsx/caxlsx/pull/504) Support automatic tick label intervals on chart axes
17
+ - [PR #508](https://github.com/caxlsx/caxlsx/pull/508) Auto-insert missing rows or columns to make autofilter works when using not yet existing ranges
18
+ - [PR #512](https://github.com/caxlsx/caxlsx/pull/512) Freeze valid tick mark values constant
19
+
20
+ - **December.03.25**: 4.4.1
21
+ - [PR #482](https://github.com/caxlsx/caxlsx/pull/482) Suppress Zip64 when it't not necessary
22
+
23
+ - **September.01.25**: 4.4.0
24
+ - [PR #477](https://github.com/caxlsx/caxlsx/pull/477) Add package-level encryption and password protection.
25
+ - [PR #476](https://github.com/caxlsx/caxlsx/pull/476) Add Excel for Windows integration testing.
26
+ - [PR #476](https://github.com/caxlsx/caxlsx/pull/476) Add Excel for MacOS integration testing.
27
+ - [PR #469](https://github.com/caxlsx/caxlsx/pull/469) Add default theme file to Excel package.
28
+ - [PR #475](https://github.com/caxlsx/caxlsx/pull/475) Use timecop to fix transient time failure in tests
29
+ - [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Add Windows and MacOS to the CI.
30
+ - [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Fix local image file MIME type detection on Windows.
31
+ - [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Load only HTTP headers when determining remote file MIME type.
32
+
33
+ - **August.16.25**: 4.3.0
34
+ - [PR #421](https://github.com/caxlsx/caxlsx/pull/421) Add Rubyzip >= 2.4 support
35
+ - [PR #448](https://github.com/caxlsx/caxlsx/pull/448) Fix Bar Chart: set axis position for Apple Numbers compatibility
36
+ - [PR #466](https://github.com/caxlsx/caxlsx/pull/466) Use RubyGem's trusted publishing
37
+ - [PR #467](https://github.com/caxlsx/caxlsx/pull/467) Add JRuby 10.0 to the CI
38
+
39
+ - **December.15.24**: 4.2.0
40
+ - [PR #359](https://github.com/caxlsx/caxlsx/pull/359) Add `PivotTable#grand_totals` option to remove grand totals row/col
41
+ - [PR #362](https://github.com/caxlsx/caxlsx/pull/362) Use widest width even if provided as fixed value
42
+ - [PR #398](https://github.com/caxlsx/caxlsx/pull/398) Add `Axlsx#uri_parser` method for RFC2396 compatibility
43
+ - [PR #390](https://github.com/caxlsx/caxlsx/pull/390) Change ISO_8601_REGEX to match how Excel handles ISO 8601 formats
44
+ - [PR #402](https://github.com/caxlsx/caxlsx/pull/402) Refactor `Axlsx::SimpleTypedList` to better match `Array` API
45
+ - [PR #409](https://github.com/caxlsx/caxlsx/pull/409) Prefer `require_relative` for internal requires
46
+ - Minor performance improvements ([PR #406](https://github.com/caxlsx/caxlsx/pull/406), [PR #407](https://github.com/caxlsx/caxlsx/pull/407), [PR #408](https://github.com/caxlsx/caxlsx/pull/408))
47
+
48
+ - **February.26.24**: 4.1.0
49
+ - [PR #316](https://github.com/caxlsx/caxlsx/pull/316) Prevent camelization of hyperlink locations
50
+ - [PR #312](https://github.com/caxlsx/caxlsx/pull/312) Added 2D/flat PieChart drawing
51
+ - [PR #317](https://github.com/caxlsx/caxlsx/pull/317) Apply style for columns without defining cells
52
+ - [PR #345](https://github.com/caxlsx/caxlsx/pull/345) Show outline symbols by default to match original behavior
53
+ - [PR #334](https://github.com/caxlsx/caxlsx/pull/334) Add pattern fill options to add_style
54
+ - [PR #342](https://github.com/caxlsx/caxlsx/pull/342) Fix show button for filter columns
55
+ - [PR #349](https://github.com/caxlsx/caxlsx/pull/349) Convert test suite to Minitest
56
+
57
+ - **October.30.23**: 4.0.0
58
+ - [PR #189](https://github.com/caxlsx/caxlsx/pull/189) **breaking** Make `Axlsx::escape_formulas` true by default to mitigate [Formula Injection](https://www.owasp.org/index.php/CSV_Injection) vulnerabilities.
59
+ - [PR #212](https://github.com/caxlsx/caxlsx/pull/212) **breaking** Raise exception if `axlsx_styler` gem is present as its code was merged directly into `caxlsx` in v3.3.0
60
+ - [PR #225](https://github.com/caxlsx/caxlsx/pull/225) **breaking** Remove ability to set `u=` to true in favor of using :single or one of the other underline options
61
+ - Drop support for Ruby versions < 2.6
62
+ - [PR #219](https://github.com/caxlsx/caxlsx/pull/219) Added frozen string literals
63
+ - [PR #223](https://github.com/caxlsx/caxlsx/pull/223) Fix `SimpleTypedList#to_a` and `SimpleTypedList#to_ary` returning the internal list instance
64
+ - [PR #239](https://github.com/caxlsx/caxlsx/pull/239) Fix `Workbook#sheet_by_name` not returning sheets with encoded characters in the name
65
+ - [PR #286](https://github.com/caxlsx/caxlsx/pull/286) Add 'SortState' and 'SortCondition' classes to the 'AutoFilter' class to add sorting to the generated file.
66
+ - [PR #269](https://github.com/caxlsx/caxlsx/pull/269) Add optional interpolation points to icon sets
67
+ - [PR #304](https://github.com/caxlsx/caxlsx/pull/304) Fix data validations for none type validations
68
+
69
+ - **April.23.23**: 3.4.1
70
+ - [PR #209](https://github.com/caxlsx/caxlsx/pull/209) - Revert characters other than `=` being considered as formulas.
71
+
72
+ - **April.12.23**: 3.4.0
73
+ - [PR #186](https://github.com/caxlsx/caxlsx/pull/186) - Add `escape_formulas` to global, workbook, worksheet, row and cell levels, and standardize behavior.
74
+ - [PR #186](https://github.com/caxlsx/caxlsx/pull/186) - `escape_formulas` should handle all [OWASP-designated formula prefixes](https://owasp.org/www-community/attacks/CSV_Injection).
75
+ - Fix bug when calling `worksheet.add_border("A1:B2", nil)`
76
+ - Change `BorderCreator#initialize` arguments handling
77
+ - Fix `add_border` to work with singular cell refs
78
+ - [PR #196](https://github.com/caxlsx/caxlsx/pull/196) - Fix tab color reassignment
79
+ - Add support for remote image source in `Pic` using External Relationship (supported in Excel documents)
80
+
5
81
  - **October.21.22**: 3.3.0
6
82
  - [PR #168](https://github.com/caxlsx/caxlsx/pull/168) - Merge in the gem [`axlsx_styler`](https://github.com/axlsx-styler-gem/axlsx_styler)
7
83
  - Add ability to both apply or append to existing styles after rows have been created using `worksheet.add_style`
@@ -132,7 +208,7 @@ CHANGELOG
132
208
  and charts to the same worksheet drawing.
133
209
  - Added outline_level_rows and outline_level_columns to worksheet to simplify setting up outlining in the worksheet.
134
210
  - Added support for pivot tables
135
- - Added support for descrete border edge styles
211
+ - Added support for discrete border edge styles
136
212
  - Improved validation of sheet names
137
213
  - Added support for formula value caching so that iOS and OSX preview can show the proper values. See Cell.add_row and the formula_values option.
138
214
 
@@ -164,7 +240,7 @@ CHANGELOG
164
240
  from the initial master.
165
241
 
166
242
  - **September.8.12**: 1.2.3
167
- - enhance exponential float/bigdecimal values rendering as strings intead
243
+ - enhance exponential float/bigdecimal values rendering as strings instead
168
244
  of 'numbers' in excel.
169
245
  - added support for :none option on chart axis labels
170
246
  - added support for paper_size option on worksheet.page_setup
@@ -198,14 +274,14 @@ CHANGELOG
198
274
  - added in interop requirements so that charts are properly exported
199
275
  to PDF from Libra Office
200
276
  - various readability improvements and work standardizing attribute
201
- names to snake_case. Aliases are provided for backward compatiblity
277
+ names to snake_case. Aliases are provided for backward compatibility
202
278
 
203
279
  - **June.11.12**: 1.1.7
204
280
  - fix chart rendering issue when label offset is specified as a
205
281
  percentage in serialization and ensure that formula are not stored
206
282
  in value caches
207
283
  - fix bug that causes repair warnings when using a text only title reference.
208
- - Add title property to axis so you can lable the x/y/series axis for
284
+ - Add title property to axis so you can label the x/y/series axis for
209
285
  charts.
210
286
  - Add sheet views with panes
211
287
 
@@ -215,14 +291,14 @@ in value caches
215
291
  - added support for two cell anchors for images
216
292
  - test coverage now back up to 100%
217
293
  - bugfix for merge cell sorting algorithm
218
- - added fit_to method for page_setup to simplify managing witdh/height
294
+ - added fit_to method for page_setup to simplify managing width/height
219
295
  - added ph (phonetics) and s (style) attributes for row.
220
296
  - resolved all warnings generating from this gem.
221
297
  - improved comment relationship management for multiple comments
222
298
 
223
299
  - **May.13.12**: 1.1.5
224
300
  - MOAR print options! You can now specify paper size, orientation,
225
- fit to width, page margings and gridlines for printing.
301
+ fit to width, page margins and gridlines for printing.
226
302
  - Support for adding comments to your worksheets
227
303
  - bugfix for applying style to empty cells
228
304
  - bugfix for parsing formula with multiple '='
@@ -297,7 +373,7 @@ in value caches
297
373
 
298
374
  - **January.6.12**: 1.0.15
299
375
  https://github.com/randym/axlsx/compare/1.0.14...1.0.15
300
- - Bug fix add_style specified number formats must be explicity applied for libraOffice
376
+ - Bug fix add_style specified number formats must be explicitly applied for libraOffice
301
377
  - performance improvements from ochko when creating cells with options.
302
378
  - Bug fix setting types=>[:n] when adding a row incorrectly determines the cell type to be string as the value is null during creation.
303
379
  - Release in preparation for password protection merge
@@ -329,7 +405,7 @@ in value caches
329
405
  - **October.30.11**: 1.0.10
330
406
  - Updating gemspec to lower gem version requirements.
331
407
  - Added row.style assignation for updating the cell style for an entire row
332
- - Added col_style method to worksheet upate a the style for a column of cells
408
+ - Added col_style method to worksheet update a the style for a column of cells
333
409
  - Added cols for an easy reference to columns in a worksheet.
334
410
  - prep for pre release of acts_as_xlsx gem
335
411
  - added in travis.ci configuration and build status
@@ -344,14 +420,14 @@ in value caches
344
420
  - Added support for images (jpg, gif, png) in worksheets.
345
421
 
346
422
  - **October.23.11**: 1.0.7 released
347
- - Added support for 3D options when creating a new chart. This lets you set the persective, rotation and other 3D attributes when using worksheet.add_chart
423
+ - Added support for 3D options when creating a new chart. This lets you set the perspective, rotation and other 3D attributes when using worksheet.add_chart
348
424
  - Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
349
425
  - updated rake to include build, genoc and deploy tasks.
350
426
  - rebuilt documentation.
351
427
  - moved version constant to its own file
352
428
  - fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
353
429
  - Review and improve docs
354
- - rebuild of anchor positioning to remove some spagetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart.
430
+ - rebuild of anchor positioning to remove some spaghetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart.
355
431
  - Refactored cat and val axis data to keep series serialization a bit more DRY
356
432
 
357
433
  - **October.22.11**: 1.0.6
@@ -371,7 +447,7 @@ in value caches
371
447
  - BugFix: shape attribute for bar chart is now properly serialized
372
448
  - BugFix: date1904 property now properly set for charts
373
449
  - Added style property to charts
374
- - Removed serialization write test as it most commonly fails when run from the gem's intalled directory
450
+ - Removed serialization write test as it most commonly fails when run from the gem's installed directory
375
451
 
376
452
  - **October.21.11**: 1.0.4
377
453
  - altered package to accept a filename string for serialization instead of a File object.
data/README.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Caxlsx (Community Continued Version)
2
- [![Build Status](https://github.com/caxlsx/caxlsx/workflows/Test/badge.svg)](https://github.com/caxlsx/caxlsx/actions)
3
- [![Gem Version](https://badge.fury.io/rb/caxlsx.svg)](http://badge.fury.io/rb/caxlsx)
4
- ![Total downloads](http://ruby-gem-downloads-badge.herokuapp.com/caxlsx?type=total)
5
- ![Downloads for 3.3.0 (latest)](http://ruby-gem-downloads-badge.herokuapp.com/caxlsx/3.3.0?label=downloads%203.3.0)
2
+ [![Test](https://github.com/caxlsx/caxlsx/actions/workflows/test.yml/badge.svg)](https://github.com/caxlsx/caxlsx/actions/workflows/test.yml)
3
+ [![RuboCop](https://github.com/caxlsx/caxlsx/actions/workflows/rubocop.yml/badge.svg)](https://github.com/caxlsx/caxlsx/actions/workflows/rubocop.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/caxlsx.svg)](https://badge.fury.io/rb/caxlsx)
5
+ ![downloads](https://img.shields.io/gem/dt/caxlsx?label=downloads)
6
6
 
7
7
  ## Notice: Community Axlsx Organization
8
8
 
9
9
  To better maintain the Axlsx ecosystem, all related gems have been forked or moved to the following community organization:
10
10
 
11
- http://github.com/caxlsx
11
+ https://github.com/caxlsx
12
12
 
13
13
  [Join the Caxlsx Slack channel](https://join.slack.com/t/caxlsx/shared_invite/enQtOTI5OTM0MzI1Njk5LTBlMDQzNDk2YzkwODMxMmVkODMyYzJiZGU5NTQ3YTg5NTBlN2IwZTlmNTRjNzhiY2E0MDY2OTEyYmFlODI5NjA)
14
14
 
15
15
  ## Synopsis
16
16
 
17
17
  Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language.
18
- With Axlsx you can create excel worksheets with charts, images (with links), automated and fixed column widths, customized styles, functions, tables, conditional formatting, print options, comments, merged cells, auto filters, file and stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
18
+ With Axlsx you can create Excel worksheets with charts, images (with links), automated and fixed column widths, customized styles, functions, tables, conditional formatting, print options, comments, merged cells, auto filters, file and stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
19
19
 
20
20
  ![Screen 1](https://github.com/caxlsx/caxlsx/raw/master/examples/sample.png)
21
21
 
@@ -51,20 +51,21 @@ cell level input data validation.
51
51
 
52
52
  15. Support for page margins and print options
53
53
 
54
- 16. Support for password and non password based sheet protection.
54
+ 16. Support for workbook-level encryption and password protection (requires [ooxml_crypt](https://github.com/teamsimplepay/ooxml_crypt) gem which only supports MRI Ruby.)
55
55
 
56
- 17. First stage interoperability support for GoogleDocs, LibreOffice,
57
- and Numbers
56
+ 17. Support for sheet-level password and non-password protection.
58
57
 
59
- 18. Support for defined names, which gives you repeated header rows for printing.
58
+ 18. First stage interoperability support for GoogleDocs, LibreOffice, and Numbers.
60
59
 
61
- 19. Data labels for charts as well as series color customization.
60
+ 19. Support for defined names, which gives you repeated header rows for printing.
62
61
 
63
- 20. Support for sheet headers and footers
62
+ 20. Data labels for charts as well as series color customization.
64
63
 
65
- 21. Pivot Tables
64
+ 21. Support for sheet headers and footers
66
65
 
67
- 22. Page Breaks
66
+ 22. Pivot Tables
67
+
68
+ 23. Page Breaks
68
69
 
69
70
 
70
71
  ## Install
@@ -73,6 +74,8 @@ and Numbers
73
74
  gem 'caxlsx'
74
75
  ```
75
76
 
77
+ **Supported Ruby versions:** Caxlsx supports Ruby 2.6 and newer.
78
+
76
79
  ## Usage
77
80
 
78
81
  Here's a teaser that kicks about 2% of what the gem can do.
@@ -105,7 +108,13 @@ Additional documentation is listed below:
105
108
  - [Style Reference](https://github.com/caxlsx/caxlsx/blob/master/docs/style_reference.md)
106
109
  - [Header and Footer Codes](https://github.com/caxlsx/caxlsx/blob/master/docs/header_and_footer_codes.md)
107
110
 
108
- ⚠ Please __do not create issues__ for questions regarding the usage of axlsx / caxlsx. Look through this README, the [examples](https://github.com/caxlsx/caxlsx/tree/master/examples/example.rb), and the [FAQ](https://github.com/caxlsx/caxlsx/wiki/FAQ), and also check [questions tagged `axlsx` on Stack Overflow](https://stackoverflow.com/questions/tagged/axlsx).
111
+ You can run the documentation on your local by running the following:
112
+ ```sh
113
+ gem install webrick
114
+ yard server
115
+ ```
116
+
117
+ ⚠ Please __do not create issues__ for questions regarding the usage of axlsx / caxlsx. Look through this README, the [examples folder](https://github.com/caxlsx/caxlsx/tree/master/examples), and the [FAQ](https://github.com/caxlsx/caxlsx/wiki/FAQ), and also check [questions tagged `axlsx` on Stack Overflow](https://stackoverflow.com/questions/tagged/axlsx).
109
118
 
110
119
  Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest.
111
120
 
@@ -119,6 +128,24 @@ Currently the following additional gems are available:
119
128
  * Provides a `.axlsx` renderer to Rails so you can move all your spreadsheet code from your controller into view files.
120
129
  - [activeadmin-caxlsx](https://github.com/caxlsx/activeadmin-caxlsx)
121
130
  * An Active Admin plugin that includes DSL to create downloadable reports.
131
+ - [ooxml_crypt](https://github.com/teamsimplepay/ooxml_crypt)
132
+ * Required to enable workbook encryption and password protection.
133
+
134
+ ## Security
135
+
136
+ To prevent [Formula Injection](https://www.owasp.org/index.php/CSV_Injection) vulnerabilities, as of version 4.0, axlsx escapes all formulas by default. To permit formulas on a specific cell, please use:
137
+
138
+ ```ruby
139
+ cell.escape_formulas = false
140
+ ```
141
+
142
+ You may set `escape_formulas` on the workbook, worksheet, row and/or cell level. Refer to examples/escape_formula.md for details.
143
+
144
+ To allow formulas globally by default (which was the behavior in axlsx 3.x and prior), you may set the following in an initializer:
145
+
146
+ ```ruby
147
+ Axlsx.escape_formulas = false
148
+ ```
122
149
 
123
150
  ## Known Software Interoperability Issues
124
151
 
@@ -160,6 +187,6 @@ See [CONTRIBUTING.md](https://github.com/caxlsx/caxlsx/blob/master/CONTRIBUTING.
160
187
 
161
188
  Originally created by Randy Morgan - @randym
162
189
 
163
- Forked in 2019, to enable the community to maintain the Axlsx ecosystem - http://github.com/caxlsx
190
+ Forked in 2019, to enable the community to maintain the Axlsx ecosystem - https://github.com/caxlsx
164
191
 
165
192
  Open source software is a community effort. None of this could have been done without the help of [our Contributors](https://github.com/caxlsx/caxlsx/graphs/contributors).
data/Rakefile CHANGED
@@ -1,11 +1,10 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/lib/axlsx/version.rb')
1
+ # frozen_string_literal: true
2
2
 
3
- task :build => :gendoc do
4
- system "gem build axlsx.gemspec"
5
- end
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
6
5
 
7
6
  task :benchmark do
8
- require File.expand_path(File.dirname(__FILE__) + '/test/benchmark.rb')
7
+ require File.expand_path("#{File.dirname(__FILE__)}/test/benchmark.rb")
9
8
  end
10
9
 
11
10
  task :gendoc do
@@ -13,7 +12,6 @@ task :gendoc do
13
12
  system "yard stats --list-undoc"
14
13
  end
15
14
 
16
-
17
15
  require 'rake/testtask'
18
16
  Rake::TestTask.new do |t|
19
17
  t.libs << 'test'
@@ -22,8 +20,4 @@ Rake::TestTask.new do |t|
22
20
  t.warning = true
23
21
  end
24
22
 
25
- task :release => :build do
26
- system "gem push caxlsx-#{Axlsx::VERSION}.gem"
27
- end
28
-
29
- task :default => :test
23
+ task default: :test
data/examples/generate.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
4
+
3
5
  files = if !ARGV.empty?
4
6
  ARGV.select { |file| File.exist?(file) }
5
7
  else
@@ -10,6 +12,6 @@ files.each do |file|
10
12
  puts "Executing #{file.split('.')[0].tr('_', ' ')}"
11
13
  code = File.read(file).match(/```ruby(?<code>.+)```/m)[:code]
12
14
  unless code.nil?
13
- eval(['$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"', code].join("\n"))
15
+ eval(code)
14
16
  end
15
17
  end
@@ -1,14 +1,14 @@
1
- module Axlsx
1
+ # frozen_string_literal: true
2
2
 
3
+ module Axlsx
3
4
  # This class extracts the common parts from Default and Override
4
5
  class AbstractContentType
5
-
6
6
  include Axlsx::OptionsParser
7
7
 
8
8
  # Initializes an abstract content type
9
9
  # @see Default, Override
10
- def initialize(options={})
11
- parse_options options
10
+ def initialize(options = {})
11
+ parse_options options
12
12
  end
13
13
 
14
14
  # The type of content.
@@ -18,15 +18,20 @@ module Axlsx
18
18
 
19
19
  # The content type.
20
20
  # @see Axlsx#validate_content_type
21
- def content_type=(v) Axlsx::validate_content_type v; @content_type = v end
21
+ def content_type=(v)
22
+ Axlsx.validate_content_type v
23
+ @content_type = v
24
+ end
22
25
  alias :ContentType= :content_type=
23
26
 
24
- # Serialize the contenty type to xml
25
- def to_xml_string(node_name = '', str = '')
26
- str << "<#{node_name} "
27
- str << Axlsx.instance_values_for(self).map { |key, value| Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ')
27
+ # Serialize the content type to xml
28
+ def to_xml_string(node_name = '', str = +'')
29
+ str << '<' << node_name << ' '
30
+ Axlsx.instance_values_for(self).each_with_index do |key_value, index|
31
+ str << ' ' unless index == 0
32
+ str << Axlsx.camel(key_value.first) << '="' << key_value.last.to_s << '"'
33
+ end
28
34
  str << '/>'
29
35
  end
30
-
31
36
  end
32
37
  end
@@ -1,26 +1,24 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
+
2
3
  module Axlsx
3
- require 'axlsx/content_type/abstract_content_type.rb'
4
- require 'axlsx/content_type/default.rb'
5
- require 'axlsx/content_type/override.rb'
4
+ require_relative 'abstract_content_type'
5
+ require_relative 'default'
6
+ require_relative 'override'
6
7
 
7
8
  # ContentTypes used in the package. This is automatically managed by the package package.
8
9
  class ContentType < SimpleTypedList
9
-
10
10
  def initialize
11
- super [Override, Default]
11
+ super([Override, Default])
12
12
  end
13
13
 
14
14
  # Serializes the object
15
15
  # @param [String] str
16
16
  # @return [String]
17
- def to_xml_string(str = '')
17
+ def to_xml_string(str = +'')
18
18
  str << '<?xml version="1.0" encoding="UTF-8"?>'
19
- str << ('<Types xmlns="' << XML_NS_T << '">')
19
+ str << '<Types xmlns="' << XML_NS_T << '">'
20
20
  each { |type| type.to_xml_string(str) }
21
21
  str << '</Types>'
22
22
  end
23
-
24
23
  end
25
-
26
24
  end
@@ -1,9 +1,8 @@
1
- # encoding: UTF-8
2
- module Axlsx
1
+ # frozen_string_literal: true
3
2
 
3
+ module Axlsx
4
4
  # An default content part. These parts are automatically created by for you based on the content of your package.
5
5
  class Default < AbstractContentType
6
-
7
6
  # The serialization node name for this class
8
7
  NODE_NAME = 'Default'
9
8
 
@@ -13,13 +12,15 @@ module Axlsx
13
12
  alias :Extension :extension
14
13
 
15
14
  # Sets the file extension for this content type.
16
- def extension=(v) Axlsx::validate_string v; @extension = v end
15
+ def extension=(v)
16
+ Axlsx.validate_string v
17
+ @extension = v
18
+ end
17
19
  alias :Extension= :extension=
18
20
 
19
21
  # Serializes this object to xml
20
- def to_xml_string(str ='')
22
+ def to_xml_string(str = +'')
21
23
  super(NODE_NAME, str)
22
24
  end
23
25
  end
24
-
25
26
  end
@@ -1,10 +1,8 @@
1
+ # frozen_string_literal: true
1
2
 
2
- # encoding: UTF-8
3
3
  module Axlsx
4
-
5
4
  # An override content part. These parts are automatically created by for you based on the content of your package.
6
5
  class Override < AbstractContentType
7
-
8
6
  # Serialization node name for this object
9
7
  NODE_NAME = 'Override'
10
8
 
@@ -14,11 +12,14 @@ module Axlsx
14
12
  alias :PartName :part_name
15
13
 
16
14
  # The name and location of the part.
17
- def part_name=(v) Axlsx::validate_string v; @part_name = v end
15
+ def part_name=(v)
16
+ Axlsx.validate_string v
17
+ @part_name = v
18
+ end
18
19
  alias :PartName= :part_name=
19
20
 
20
21
  # Serializes this object to xml
21
- def to_xml_string(str = '')
22
+ def to_xml_string(str = +'')
22
23
  super(NODE_NAME, str)
23
24
  end
24
25
  end