caxlsx 4.0.0 → 4.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -12
- data/README.md +18 -9
- data/Rakefile +2 -9
- data/examples/generate.rb +3 -1
- data/lib/axlsx/content_type/abstract_content_type.rb +6 -3
- data/lib/axlsx/content_type/content_type.rb +4 -4
- data/lib/axlsx/content_type/default.rb +4 -1
- data/lib/axlsx/content_type/override.rb +4 -1
- data/lib/axlsx/doc_props/app.rb +91 -24
- data/lib/axlsx/drawing/area_chart.rb +3 -3
- data/lib/axlsx/drawing/area_series.rb +10 -4
- data/lib/axlsx/drawing/ax_data_source.rb +1 -1
- data/lib/axlsx/drawing/axes.rb +1 -1
- data/lib/axlsx/drawing/axis.rb +25 -7
- data/lib/axlsx/drawing/bar_3D_chart.rb +14 -4
- data/lib/axlsx/drawing/bar_chart.rb +14 -4
- data/lib/axlsx/drawing/bar_series.rb +14 -5
- data/lib/axlsx/drawing/bubble_chart.rb +2 -2
- data/lib/axlsx/drawing/bubble_series.rb +2 -2
- data/lib/axlsx/drawing/cat_axis.rb +23 -8
- data/lib/axlsx/drawing/chart.rb +33 -8
- data/lib/axlsx/drawing/d_lbls.rb +9 -8
- data/lib/axlsx/drawing/drawing.rb +50 -49
- data/lib/axlsx/drawing/hyperlink.rb +13 -4
- data/lib/axlsx/drawing/line_3D_chart.rb +3 -3
- data/lib/axlsx/drawing/line_chart.rb +3 -3
- data/lib/axlsx/drawing/line_series.rb +10 -4
- data/lib/axlsx/drawing/marker.rb +19 -4
- data/lib/axlsx/drawing/num_val.rb +1 -1
- data/lib/axlsx/drawing/one_cell_anchor.rb +8 -2
- data/lib/axlsx/drawing/pic.rb +17 -8
- data/lib/axlsx/drawing/pie_3D_chart.rb +3 -3
- data/lib/axlsx/drawing/pie_chart.rb +36 -0
- data/lib/axlsx/drawing/pie_series.rb +18 -6
- data/lib/axlsx/drawing/scaling.rb +18 -4
- data/lib/axlsx/drawing/scatter_chart.rb +2 -2
- data/lib/axlsx/drawing/scatter_series.rb +2 -2
- data/lib/axlsx/drawing/ser_axis.rb +11 -5
- data/lib/axlsx/drawing/series.rb +8 -2
- data/lib/axlsx/drawing/two_cell_anchor.rb +1 -1
- data/lib/axlsx/drawing/val_axis.rb +2 -2
- data/lib/axlsx/drawing/view_3D.rb +8 -2
- data/lib/axlsx/drawing/vml_shape.rb +1 -1
- data/lib/axlsx/package.rb +54 -21
- data/lib/axlsx/rels/relationship.rb +15 -5
- data/lib/axlsx/rels/relationships.rb +3 -3
- data/lib/axlsx/stylesheet/border.rb +12 -3
- data/lib/axlsx/stylesheet/border_pr.rb +16 -4
- data/lib/axlsx/stylesheet/cell_alignment.rb +39 -10
- data/lib/axlsx/stylesheet/cell_protection.rb +9 -2
- data/lib/axlsx/stylesheet/cell_style.rb +30 -7
- data/lib/axlsx/stylesheet/color.rb +10 -4
- data/lib/axlsx/stylesheet/dxf.rb +29 -6
- data/lib/axlsx/stylesheet/fill.rb +4 -1
- data/lib/axlsx/stylesheet/font.rb +59 -13
- data/lib/axlsx/stylesheet/gradient_fill.rb +9 -3
- data/lib/axlsx/stylesheet/gradient_stop.rb +9 -2
- data/lib/axlsx/stylesheet/num_fmt.rb +8 -2
- data/lib/axlsx/stylesheet/pattern_fill.rb +15 -3
- data/lib/axlsx/stylesheet/styles.rb +84 -43
- data/lib/axlsx/stylesheet/table_style.rb +15 -4
- data/lib/axlsx/stylesheet/table_style_element.rb +12 -3
- data/lib/axlsx/stylesheet/table_styles.rb +10 -3
- data/lib/axlsx/stylesheet/theme.rb +163 -0
- data/lib/axlsx/stylesheet/xf.rb +70 -16
- data/lib/axlsx/util/accessors.rb +9 -7
- data/lib/axlsx/util/buffered_zip_output_stream.rb +6 -2
- data/lib/axlsx/util/constants.rb +14 -2
- data/lib/axlsx/util/mime_type_utils.rb +72 -13
- data/lib/axlsx/util/serialized_attributes.rb +2 -2
- data/lib/axlsx/util/simple_typed_list.rb +26 -14
- data/lib/axlsx/util/storage.rb +4 -4
- data/lib/axlsx/util/uri_utils.rb +70 -0
- data/lib/axlsx/util/validators.rb +6 -6
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/defined_name.rb +2 -1
- data/lib/axlsx/workbook/defined_names.rb +1 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +3 -3
- data/lib/axlsx/workbook/workbook.rb +87 -67
- data/lib/axlsx/workbook/workbook_view.rb +1 -1
- data/lib/axlsx/workbook/workbook_views.rb +1 -1
- data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +4 -4
- data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +5 -3
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +4 -4
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb +1 -1
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_state.rb +2 -2
- data/lib/axlsx/workbook/worksheet/border_creator.rb +4 -4
- data/lib/axlsx/workbook/worksheet/cell.rb +40 -20
- data/lib/axlsx/workbook/worksheet/cell_serializer.rb +1 -1
- data/lib/axlsx/workbook/worksheet/cfvo.rb +8 -2
- data/lib/axlsx/workbook/worksheet/col.rb +23 -9
- data/lib/axlsx/workbook/worksheet/col_breaks.rb +1 -1
- data/lib/axlsx/workbook/worksheet/cols.rb +1 -1
- data/lib/axlsx/workbook/worksheet/comment.rb +2 -2
- data/lib/axlsx/workbook/worksheet/comments.rb +1 -1
- data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +9 -3
- data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +70 -15
- data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +3 -3
- data/lib/axlsx/workbook/worksheet/data_validation.rb +53 -14
- data/lib/axlsx/workbook/worksheet/data_validations.rb +3 -3
- data/lib/axlsx/workbook/worksheet/date_time_converter.rb +2 -2
- data/lib/axlsx/workbook/worksheet/dimension.rb +1 -1
- data/lib/axlsx/workbook/worksheet/header_footer.rb +1 -1
- data/lib/axlsx/workbook/worksheet/icon_set.rb +17 -5
- data/lib/axlsx/workbook/worksheet/merged_cells.rb +1 -1
- data/lib/axlsx/workbook/worksheet/outline_pr.rb +1 -1
- data/lib/axlsx/workbook/worksheet/page_margins.rb +30 -7
- data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +1 -2
- data/lib/axlsx/workbook/worksheet/page_setup.rb +32 -9
- data/lib/axlsx/workbook/worksheet/pane.rb +9 -2
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +30 -6
- data/lib/axlsx/workbook/worksheet/pivot_tables.rb +1 -1
- data/lib/axlsx/workbook/worksheet/print_options.rb +1 -0
- data/lib/axlsx/workbook/worksheet/protected_ranges.rb +1 -1
- data/lib/axlsx/workbook/worksheet/rich_text_run.rb +31 -11
- data/lib/axlsx/workbook/worksheet/row.rb +5 -2
- data/lib/axlsx/workbook/worksheet/row_breaks.rb +1 -1
- data/lib/axlsx/workbook/worksheet/selection.rb +8 -2
- data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +1 -0
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +1 -1
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +1 -1
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +30 -9
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +3 -2
- data/lib/axlsx/workbook/worksheet/tables.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet.rb +28 -14
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +4 -4
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +3 -2
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +2 -2
- data/lib/axlsx.rb +46 -30
- data/lib/caxlsx.rb +1 -1
- metadata +13 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dcbb7e84632bd4649224e5d86f862f8f72a4782213f26a93b8b526e6fd303c23
|
|
4
|
+
data.tar.gz: bba54de54404af1abad6be6a853a69d8702222dbe1e7f7abfffdd397ade6afeb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1d3e462d9cc08999723034b1b75553f2e05da0a98c802adf6a90378761d8b2bbe4eb25d2092452678a359bcc5b67aa54d3b3638c368a82d2b6a1b898bd2310d
|
|
7
|
+
data.tar.gz: ac43a99324114c37ba093a19212685f206f844d8991d4d0da48e9421d0efedcb00ef1799e74bafc66be400c32fd9bd5684ae8b6a9694b9fad81bdb60bfd51be9
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@ CHANGELOG
|
|
|
2
2
|
---------
|
|
3
3
|
- **Unreleased**
|
|
4
4
|
|
|
5
|
+
- **December.03.25**: 4.4.1
|
|
6
|
+
- [PR #482](https://github.com/caxlsx/caxlsx/pull/482) Suppress Zip64 when it't not necessary
|
|
7
|
+
|
|
8
|
+
- **September.01.25**: 4.4.0
|
|
9
|
+
- [PR #477](https://github.com/caxlsx/caxlsx/pull/477) Add package-level encryption and password protection.
|
|
10
|
+
- [PR #476](https://github.com/caxlsx/caxlsx/pull/476) Add Excel for Windows integration testing.
|
|
11
|
+
- [PR #476](https://github.com/caxlsx/caxlsx/pull/476) Add Excel for MacOS integration testing.
|
|
12
|
+
- [PR #469](https://github.com/caxlsx/caxlsx/pull/469) Add default theme file to Excel package.
|
|
13
|
+
- [PR #475](https://github.com/caxlsx/caxlsx/pull/475) Use timecop to fix transient time failure in tests
|
|
14
|
+
- [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Add Windows and MacOS to the CI.
|
|
15
|
+
- [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Fix local image file MIME type detection on Windows.
|
|
16
|
+
- [PR #474](https://github.com/caxlsx/caxlsx/pull/474) Load only HTTP headers when determining remote file MIME type.
|
|
17
|
+
|
|
18
|
+
- **August.16.25**: 4.3.0
|
|
19
|
+
- [PR #421](https://github.com/caxlsx/caxlsx/pull/421) Add Rubyzip >= 2.4 support
|
|
20
|
+
- [PR #448](https://github.com/caxlsx/caxlsx/pull/448) Fix Bar Chart: set axis position for Apple Numbers compatibility
|
|
21
|
+
- [PR #466](https://github.com/caxlsx/caxlsx/pull/466) Use RubyGem's trusted publishing
|
|
22
|
+
- [PR #467](https://github.com/caxlsx/caxlsx/pull/467) Add JRuby 10.0 to the CI
|
|
23
|
+
|
|
24
|
+
- **December.15.24**: 4.2.0
|
|
25
|
+
- [PR #359](https://github.com/caxlsx/caxlsx/pull/359) Add `PivotTable#grand_totals` option to remove grand totals row/col
|
|
26
|
+
- [PR #362](https://github.com/caxlsx/caxlsx/pull/362) Use widest width even if provided as fixed value
|
|
27
|
+
- [PR #398](https://github.com/caxlsx/caxlsx/pull/398) Add `Axlsx#uri_parser` method for RFC2396 compatibility
|
|
28
|
+
- [PR #390](https://github.com/caxlsx/caxlsx/pull/390) Change ISO_8601_REGEX to match how Excel handles ISO 8601 formats
|
|
29
|
+
- [PR #402](https://github.com/caxlsx/caxlsx/pull/402) Refactor `Axlsx::SimpleTypedList` to better match `Array` API
|
|
30
|
+
- [PR #409](https://github.com/caxlsx/caxlsx/pull/409) Prefer `require_relative` for internal requires
|
|
31
|
+
- 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))
|
|
32
|
+
|
|
33
|
+
- **February.26.24**: 4.1.0
|
|
34
|
+
- [PR #316](https://github.com/caxlsx/caxlsx/pull/316) Prevent camelization of hyperlink locations
|
|
35
|
+
- [PR #312](https://github.com/caxlsx/caxlsx/pull/312) Added 2D/flat PieChart drawing
|
|
36
|
+
- [PR #317](https://github.com/caxlsx/caxlsx/pull/317) Apply style for columns without defining cells
|
|
37
|
+
- [PR #345](https://github.com/caxlsx/caxlsx/pull/345) Show outline symbols by default to match original behavior
|
|
38
|
+
- [PR #334](https://github.com/caxlsx/caxlsx/pull/334) Add pattern fill options to add_style
|
|
39
|
+
- [PR #342](https://github.com/caxlsx/caxlsx/pull/342) Fix show button for filter columns
|
|
40
|
+
- [PR #349](https://github.com/caxlsx/caxlsx/pull/349) Convert test suite to Minitest
|
|
5
41
|
|
|
6
42
|
- **October.30.23**: 4.0.0
|
|
7
43
|
- [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.
|
|
@@ -23,7 +59,7 @@ CHANGELOG
|
|
|
23
59
|
- [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).
|
|
24
60
|
- Fix bug when calling `worksheet.add_border("A1:B2", nil)`
|
|
25
61
|
- Change `BorderCreator#initialize` arguments handling
|
|
26
|
-
- Fix `add_border` to work with
|
|
62
|
+
- Fix `add_border` to work with singular cell refs
|
|
27
63
|
- [PR #196](https://github.com/caxlsx/caxlsx/pull/196) - Fix tab color reassignment
|
|
28
64
|
- Add support for remote image source in `Pic` using External Relationship (supported in Excel documents)
|
|
29
65
|
|
|
@@ -157,7 +193,7 @@ CHANGELOG
|
|
|
157
193
|
and charts to the same worksheet drawing.
|
|
158
194
|
- Added outline_level_rows and outline_level_columns to worksheet to simplify setting up outlining in the worksheet.
|
|
159
195
|
- Added support for pivot tables
|
|
160
|
-
- Added support for
|
|
196
|
+
- Added support for discrete border edge styles
|
|
161
197
|
- Improved validation of sheet names
|
|
162
198
|
- 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.
|
|
163
199
|
|
|
@@ -189,7 +225,7 @@ CHANGELOG
|
|
|
189
225
|
from the initial master.
|
|
190
226
|
|
|
191
227
|
- **September.8.12**: 1.2.3
|
|
192
|
-
- enhance exponential float/bigdecimal values rendering as strings
|
|
228
|
+
- enhance exponential float/bigdecimal values rendering as strings instead
|
|
193
229
|
of 'numbers' in excel.
|
|
194
230
|
- added support for :none option on chart axis labels
|
|
195
231
|
- added support for paper_size option on worksheet.page_setup
|
|
@@ -223,14 +259,14 @@ CHANGELOG
|
|
|
223
259
|
- added in interop requirements so that charts are properly exported
|
|
224
260
|
to PDF from Libra Office
|
|
225
261
|
- various readability improvements and work standardizing attribute
|
|
226
|
-
names to snake_case. Aliases are provided for backward
|
|
262
|
+
names to snake_case. Aliases are provided for backward compatibility
|
|
227
263
|
|
|
228
264
|
- **June.11.12**: 1.1.7
|
|
229
265
|
- fix chart rendering issue when label offset is specified as a
|
|
230
266
|
percentage in serialization and ensure that formula are not stored
|
|
231
267
|
in value caches
|
|
232
268
|
- fix bug that causes repair warnings when using a text only title reference.
|
|
233
|
-
- Add title property to axis so you can
|
|
269
|
+
- Add title property to axis so you can label the x/y/series axis for
|
|
234
270
|
charts.
|
|
235
271
|
- Add sheet views with panes
|
|
236
272
|
|
|
@@ -240,14 +276,14 @@ in value caches
|
|
|
240
276
|
- added support for two cell anchors for images
|
|
241
277
|
- test coverage now back up to 100%
|
|
242
278
|
- bugfix for merge cell sorting algorithm
|
|
243
|
-
- added fit_to method for page_setup to simplify managing
|
|
279
|
+
- added fit_to method for page_setup to simplify managing width/height
|
|
244
280
|
- added ph (phonetics) and s (style) attributes for row.
|
|
245
281
|
- resolved all warnings generating from this gem.
|
|
246
282
|
- improved comment relationship management for multiple comments
|
|
247
283
|
|
|
248
284
|
- **May.13.12**: 1.1.5
|
|
249
285
|
- MOAR print options! You can now specify paper size, orientation,
|
|
250
|
-
fit to width, page
|
|
286
|
+
fit to width, page margins and gridlines for printing.
|
|
251
287
|
- Support for adding comments to your worksheets
|
|
252
288
|
- bugfix for applying style to empty cells
|
|
253
289
|
- bugfix for parsing formula with multiple '='
|
|
@@ -322,7 +358,7 @@ in value caches
|
|
|
322
358
|
|
|
323
359
|
- **January.6.12**: 1.0.15
|
|
324
360
|
https://github.com/randym/axlsx/compare/1.0.14...1.0.15
|
|
325
|
-
- Bug fix add_style specified number formats must be
|
|
361
|
+
- Bug fix add_style specified number formats must be explicitly applied for libraOffice
|
|
326
362
|
- performance improvements from ochko when creating cells with options.
|
|
327
363
|
- Bug fix setting types=>[:n] when adding a row incorrectly determines the cell type to be string as the value is null during creation.
|
|
328
364
|
- Release in preparation for password protection merge
|
|
@@ -354,7 +390,7 @@ in value caches
|
|
|
354
390
|
- **October.30.11**: 1.0.10
|
|
355
391
|
- Updating gemspec to lower gem version requirements.
|
|
356
392
|
- Added row.style assignation for updating the cell style for an entire row
|
|
357
|
-
- Added col_style method to worksheet
|
|
393
|
+
- Added col_style method to worksheet update a the style for a column of cells
|
|
358
394
|
- Added cols for an easy reference to columns in a worksheet.
|
|
359
395
|
- prep for pre release of acts_as_xlsx gem
|
|
360
396
|
- added in travis.ci configuration and build status
|
|
@@ -369,14 +405,14 @@ in value caches
|
|
|
369
405
|
- Added support for images (jpg, gif, png) in worksheets.
|
|
370
406
|
|
|
371
407
|
- **October.23.11**: 1.0.7 released
|
|
372
|
-
- Added support for 3D options when creating a new chart. This lets you set the
|
|
408
|
+
- 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
|
|
373
409
|
- Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
|
|
374
410
|
- updated rake to include build, genoc and deploy tasks.
|
|
375
411
|
- rebuilt documentation.
|
|
376
412
|
- moved version constant to its own file
|
|
377
413
|
- fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
|
|
378
414
|
- Review and improve docs
|
|
379
|
-
- rebuild of anchor positioning to remove some
|
|
415
|
+
- 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.
|
|
380
416
|
- Refactored cat and val axis data to keep series serialization a bit more DRY
|
|
381
417
|
|
|
382
418
|
- **October.22.11**: 1.0.6
|
|
@@ -396,7 +432,7 @@ in value caches
|
|
|
396
432
|
- BugFix: shape attribute for bar chart is now properly serialized
|
|
397
433
|
- BugFix: date1904 property now properly set for charts
|
|
398
434
|
- Added style property to charts
|
|
399
|
-
- Removed serialization write test as it most commonly fails when run from the gem's
|
|
435
|
+
- Removed serialization write test as it most commonly fails when run from the gem's installed directory
|
|
400
436
|
|
|
401
437
|
- **October.21.11**: 1.0.4
|
|
402
438
|
- altered package to accept a filename string for serialization instead of a File object.
|
data/README.md
CHANGED
|
@@ -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
|
|
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.
|
|
57
|
-
and Numbers
|
|
56
|
+
17. Support for sheet-level password and non-password protection.
|
|
58
57
|
|
|
59
|
-
18.
|
|
58
|
+
18. First stage interoperability support for GoogleDocs, LibreOffice, and Numbers.
|
|
60
59
|
|
|
61
|
-
19.
|
|
60
|
+
19. Support for defined names, which gives you repeated header rows for printing.
|
|
62
61
|
|
|
63
|
-
20.
|
|
62
|
+
20. Data labels for charts as well as series color customization.
|
|
64
63
|
|
|
65
|
-
21.
|
|
64
|
+
21. Support for sheet headers and footers
|
|
66
65
|
|
|
67
|
-
22.
|
|
66
|
+
22. Pivot Tables
|
|
67
|
+
|
|
68
|
+
23. Page Breaks
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
## Install
|
|
@@ -107,7 +108,13 @@ Additional documentation is listed below:
|
|
|
107
108
|
- [Style Reference](https://github.com/caxlsx/caxlsx/blob/master/docs/style_reference.md)
|
|
108
109
|
- [Header and Footer Codes](https://github.com/caxlsx/caxlsx/blob/master/docs/header_and_footer_codes.md)
|
|
109
110
|
|
|
110
|
-
|
|
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).
|
|
111
118
|
|
|
112
119
|
Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest.
|
|
113
120
|
|
|
@@ -121,6 +128,8 @@ Currently the following additional gems are available:
|
|
|
121
128
|
* Provides a `.axlsx` renderer to Rails so you can move all your spreadsheet code from your controller into view files.
|
|
122
129
|
- [activeadmin-caxlsx](https://github.com/caxlsx/activeadmin-caxlsx)
|
|
123
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.
|
|
124
133
|
|
|
125
134
|
## Security
|
|
126
135
|
|
data/Rakefile
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
|
|
5
|
-
task build: :gendoc do
|
|
6
|
-
system "gem build axlsx.gemspec"
|
|
7
|
-
end
|
|
3
|
+
require 'bundler'
|
|
4
|
+
Bundler::GemHelper.install_tasks
|
|
8
5
|
|
|
9
6
|
task :benchmark do
|
|
10
7
|
require File.expand_path("#{File.dirname(__FILE__)}/test/benchmark.rb")
|
|
@@ -23,8 +20,4 @@ Rake::TestTask.new do |t|
|
|
|
23
20
|
t.warning = true
|
|
24
21
|
end
|
|
25
22
|
|
|
26
|
-
task release: :build do
|
|
27
|
-
system "gem push caxlsx-#{Axlsx::VERSION}.gem"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
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(
|
|
15
|
+
eval(code)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -18,14 +18,17 @@ module Axlsx
|
|
|
18
18
|
|
|
19
19
|
# The content type.
|
|
20
20
|
# @see Axlsx#validate_content_type
|
|
21
|
-
def content_type=(v)
|
|
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
|
|
27
|
+
# Serialize the content type to xml
|
|
25
28
|
def to_xml_string(node_name = '', str = +'')
|
|
26
29
|
str << '<' << node_name << ' '
|
|
27
30
|
Axlsx.instance_values_for(self).each_with_index do |key_value, index|
|
|
28
|
-
str << ' ' unless index
|
|
31
|
+
str << ' ' unless index == 0
|
|
29
32
|
str << Axlsx.camel(key_value.first) << '="' << key_value.last.to_s << '"'
|
|
30
33
|
end
|
|
31
34
|
str << '/>'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Axlsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
require_relative 'abstract_content_type'
|
|
5
|
+
require_relative 'default'
|
|
6
|
+
require_relative 'override'
|
|
7
7
|
|
|
8
8
|
# ContentTypes used in the package. This is automatically managed by the package package.
|
|
9
9
|
class ContentType < SimpleTypedList
|
|
10
10
|
def initialize
|
|
11
|
-
super
|
|
11
|
+
super([Override, Default])
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# Serializes the object
|
|
@@ -12,7 +12,10 @@ module Axlsx
|
|
|
12
12
|
alias :Extension :extension
|
|
13
13
|
|
|
14
14
|
# Sets the file extension for this content type.
|
|
15
|
-
def extension=(v)
|
|
15
|
+
def extension=(v)
|
|
16
|
+
Axlsx.validate_string v
|
|
17
|
+
@extension = v
|
|
18
|
+
end
|
|
16
19
|
alias :Extension= :extension=
|
|
17
20
|
|
|
18
21
|
# Serializes this object to xml
|
|
@@ -12,7 +12,10 @@ module Axlsx
|
|
|
12
12
|
alias :PartName :part_name
|
|
13
13
|
|
|
14
14
|
# The name and location of the part.
|
|
15
|
-
def part_name=(v)
|
|
15
|
+
def part_name=(v)
|
|
16
|
+
Axlsx.validate_string v
|
|
17
|
+
@part_name = v
|
|
18
|
+
end
|
|
16
19
|
alias :PartName= :part_name=
|
|
17
20
|
|
|
18
21
|
# Serializes this object to xml
|
data/lib/axlsx/doc_props/app.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Axlsx
|
|
|
75
75
|
attr_reader :paragraphs
|
|
76
76
|
alias :Paragraphs :paragraphs
|
|
77
77
|
|
|
78
|
-
# @return [
|
|
78
|
+
# @return [Integer] The number of slides in the document.
|
|
79
79
|
attr_reader :slides
|
|
80
80
|
alias :Slides :slides
|
|
81
81
|
|
|
@@ -121,7 +121,7 @@ module Axlsx
|
|
|
121
121
|
|
|
122
122
|
# @return [String] The name of the application
|
|
123
123
|
attr_reader :application
|
|
124
|
-
alias :
|
|
124
|
+
alias :Application :application
|
|
125
125
|
|
|
126
126
|
# @return [String] The version of the application.
|
|
127
127
|
attr_reader :app_version
|
|
@@ -132,89 +132,156 @@ module Axlsx
|
|
|
132
132
|
alias :DocSecurity :doc_security
|
|
133
133
|
|
|
134
134
|
# Sets the template property of your app.xml file
|
|
135
|
-
def template=(v)
|
|
135
|
+
def template=(v)
|
|
136
|
+
Axlsx.validate_string v
|
|
137
|
+
@template = v
|
|
138
|
+
end
|
|
136
139
|
alias :Template= :template=
|
|
137
140
|
|
|
138
141
|
# Sets the manager property of your app.xml file
|
|
139
|
-
def manager=(v)
|
|
142
|
+
def manager=(v)
|
|
143
|
+
Axlsx.validate_string v
|
|
144
|
+
@manager = v
|
|
145
|
+
end
|
|
140
146
|
alias :Manager= :manager=
|
|
141
147
|
|
|
142
148
|
# Sets the company property of your app.xml file
|
|
143
|
-
def company=(v)
|
|
149
|
+
def company=(v)
|
|
150
|
+
Axlsx.validate_string v
|
|
151
|
+
@company = v
|
|
152
|
+
end
|
|
144
153
|
alias :Company= :company=
|
|
154
|
+
|
|
145
155
|
# Sets the pages property of your app.xml file
|
|
146
|
-
def pages=(v)
|
|
156
|
+
def pages=(v)
|
|
157
|
+
Axlsx.validate_int v
|
|
158
|
+
@pages = v
|
|
159
|
+
end
|
|
147
160
|
|
|
148
161
|
# Sets the words property of your app.xml file
|
|
149
|
-
def words=(v)
|
|
162
|
+
def words=(v)
|
|
163
|
+
Axlsx.validate_int v
|
|
164
|
+
@words = v
|
|
165
|
+
end
|
|
150
166
|
alias :Words= :words=
|
|
151
167
|
|
|
152
168
|
# Sets the characters property of your app.xml file
|
|
153
|
-
def characters=(v)
|
|
169
|
+
def characters=(v)
|
|
170
|
+
Axlsx.validate_int v
|
|
171
|
+
@characters = v
|
|
172
|
+
end
|
|
154
173
|
alias :Characters= :characters=
|
|
155
174
|
|
|
156
175
|
# Sets the presentation_format property of your app.xml file
|
|
157
|
-
def presentation_format=(v)
|
|
176
|
+
def presentation_format=(v)
|
|
177
|
+
Axlsx.validate_string v
|
|
178
|
+
@presentation_format = v
|
|
179
|
+
end
|
|
158
180
|
alias :PresentationFormat= :presentation_format=
|
|
159
181
|
|
|
160
182
|
# Sets the lines property of your app.xml file
|
|
161
|
-
def lines=(v)
|
|
183
|
+
def lines=(v)
|
|
184
|
+
Axlsx.validate_int v
|
|
185
|
+
@lines = v
|
|
186
|
+
end
|
|
162
187
|
alias :Lines= :lines=
|
|
163
188
|
|
|
164
189
|
# Sets the paragraphs property of your app.xml file
|
|
165
|
-
def paragraphs=(v)
|
|
190
|
+
def paragraphs=(v)
|
|
191
|
+
Axlsx.validate_int v
|
|
192
|
+
@paragraphs = v
|
|
193
|
+
end
|
|
166
194
|
alias :Paragraphs= :paragraphs=
|
|
167
195
|
|
|
168
196
|
# sets the slides property of your app.xml file
|
|
169
|
-
def slides=(v)
|
|
197
|
+
def slides=(v)
|
|
198
|
+
Axlsx.validate_int v
|
|
199
|
+
@slides = v
|
|
200
|
+
end
|
|
170
201
|
alias :Slides= :slides=
|
|
171
202
|
|
|
172
203
|
# sets the notes property of your app.xml file
|
|
173
|
-
def notes=(v)
|
|
204
|
+
def notes=(v)
|
|
205
|
+
Axlsx.validate_int v
|
|
206
|
+
@notes = v
|
|
207
|
+
end
|
|
174
208
|
alias :Notes= :notes=
|
|
175
209
|
|
|
176
210
|
# Sets the total_time property of your app.xml file
|
|
177
|
-
def total_time=(v)
|
|
211
|
+
def total_time=(v)
|
|
212
|
+
Axlsx.validate_int v
|
|
213
|
+
@total_time = v
|
|
214
|
+
end
|
|
178
215
|
alias :TotalTime= :total_time=
|
|
179
216
|
|
|
180
217
|
# Sets the hidden_slides property of your app.xml file
|
|
181
|
-
def hidden_slides=(v)
|
|
218
|
+
def hidden_slides=(v)
|
|
219
|
+
Axlsx.validate_int v
|
|
220
|
+
@hidden_slides = v
|
|
221
|
+
end
|
|
182
222
|
alias :HiddenSlides= :hidden_slides=
|
|
183
223
|
|
|
184
224
|
# Sets the m_m_clips property of your app.xml file
|
|
185
|
-
def m_m_clips=(v)
|
|
225
|
+
def m_m_clips=(v)
|
|
226
|
+
Axlsx.validate_int v
|
|
227
|
+
@m_m_clips = v
|
|
228
|
+
end
|
|
186
229
|
alias :MMClips= :m_m_clips=
|
|
187
230
|
|
|
188
231
|
# Sets the scale_crop property of your app.xml file
|
|
189
|
-
def scale_crop=(v)
|
|
232
|
+
def scale_crop=(v)
|
|
233
|
+
Axlsx.validate_boolean v
|
|
234
|
+
@scale_crop = v
|
|
235
|
+
end
|
|
190
236
|
alias :ScaleCrop= :scale_crop=
|
|
191
237
|
|
|
192
238
|
# Sets the links_up_to_date property of your app.xml file
|
|
193
|
-
def links_up_to_date=(v)
|
|
239
|
+
def links_up_to_date=(v)
|
|
240
|
+
Axlsx.validate_boolean v
|
|
241
|
+
@links_up_to_date = v
|
|
242
|
+
end
|
|
194
243
|
alias :LinksUpToDate= :links_up_to_date=
|
|
195
244
|
|
|
196
245
|
# Sets the characters_with_spaces property of your app.xml file
|
|
197
|
-
def characters_with_spaces=(v)
|
|
246
|
+
def characters_with_spaces=(v)
|
|
247
|
+
Axlsx.validate_int v
|
|
248
|
+
@characters_with_spaces = v
|
|
249
|
+
end
|
|
198
250
|
alias :CharactersWithSpaces= :characters_with_spaces=
|
|
199
251
|
|
|
200
252
|
# Sets the share_doc property of your app.xml file
|
|
201
|
-
def shared_doc=(v)
|
|
253
|
+
def shared_doc=(v)
|
|
254
|
+
Axlsx.validate_boolean v
|
|
255
|
+
@shared_doc = v
|
|
256
|
+
end
|
|
202
257
|
alias :SharedDoc= :shared_doc=
|
|
203
258
|
|
|
204
259
|
# Sets the hyperlink_base property of your app.xml file
|
|
205
|
-
def hyperlink_base=(v)
|
|
260
|
+
def hyperlink_base=(v)
|
|
261
|
+
Axlsx.validate_string v
|
|
262
|
+
@hyperlink_base = v
|
|
263
|
+
end
|
|
206
264
|
alias :HyperlinkBase= :hyperlink_base=
|
|
207
265
|
|
|
208
266
|
# Sets the HyperLinksChanged property of your app.xml file
|
|
209
|
-
def hyperlinks_changed=(v)
|
|
267
|
+
def hyperlinks_changed=(v)
|
|
268
|
+
Axlsx.validate_boolean v
|
|
269
|
+
@hyperlinks_changed = v
|
|
270
|
+
end
|
|
210
271
|
alias :HyperLinksChanged= :hyperlinks_changed=
|
|
211
272
|
|
|
212
273
|
# Sets the app_version property of your app.xml file
|
|
213
|
-
def app_version=(v)
|
|
274
|
+
def app_version=(v)
|
|
275
|
+
Axlsx.validate_string v
|
|
276
|
+
@app_version = v
|
|
277
|
+
end
|
|
214
278
|
alias :AppVersion= :app_version=
|
|
215
279
|
|
|
216
280
|
# Sets the doc_security property of your app.xml file
|
|
217
|
-
def doc_security=(v)
|
|
281
|
+
def doc_security=(v)
|
|
282
|
+
Axlsx.validate_int v
|
|
283
|
+
@doc_security = v
|
|
284
|
+
end
|
|
218
285
|
alias :DocSecurity= :doc_security=
|
|
219
286
|
|
|
220
287
|
# Serialize the app.xml document
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Axlsx
|
|
4
|
-
# The AreaChart is a two
|
|
4
|
+
# The AreaChart is a two dimensional line chart (who would have guessed?) that you can add to your worksheet.
|
|
5
5
|
# @example Creating a chart
|
|
6
6
|
# # This example creates a line in a single sheet.
|
|
7
7
|
# require "rubygems" # if that is your preferred way to manage gems!
|
|
@@ -47,7 +47,7 @@ module Axlsx
|
|
|
47
47
|
def initialize(frame, options = {})
|
|
48
48
|
@vary_colors = false
|
|
49
49
|
@grouping = :standard
|
|
50
|
-
super
|
|
50
|
+
super
|
|
51
51
|
@series_type = AreaSeries
|
|
52
52
|
@d_lbls = nil
|
|
53
53
|
end
|
|
@@ -75,7 +75,7 @@ module Axlsx
|
|
|
75
75
|
# @param [String] str
|
|
76
76
|
# @return [String]
|
|
77
77
|
def to_xml_string(str = +'')
|
|
78
|
-
super
|
|
78
|
+
super do
|
|
79
79
|
str << "<c:" << node_name << ">"
|
|
80
80
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|
|
81
81
|
str << '<c:varyColors val="' << vary_colors.to_s << '"/>'
|
|
@@ -40,7 +40,7 @@ module Axlsx
|
|
|
40
40
|
@marker_symbol = options[:marker_symbol] || :default
|
|
41
41
|
@smooth = false
|
|
42
42
|
@labels, @data = nil, nil
|
|
43
|
-
super
|
|
43
|
+
super
|
|
44
44
|
@labels = AxDataSource.new(data: options[:labels]) unless options[:labels].nil?
|
|
45
45
|
@data = NumDataSource.new(options) unless options[:data].nil?
|
|
46
46
|
end
|
|
@@ -72,7 +72,7 @@ module Axlsx
|
|
|
72
72
|
# @param [String] str
|
|
73
73
|
# @return [String]
|
|
74
74
|
def to_xml_string(str = +'')
|
|
75
|
-
super
|
|
75
|
+
super do
|
|
76
76
|
if color
|
|
77
77
|
str << '<c:spPr><a:solidFill>'
|
|
78
78
|
str << '<a:srgbClr val="' << color << '"/>'
|
|
@@ -101,9 +101,15 @@ module Axlsx
|
|
|
101
101
|
private
|
|
102
102
|
|
|
103
103
|
# assigns the data for this series
|
|
104
|
-
def data=(v)
|
|
104
|
+
def data=(v)
|
|
105
|
+
DataTypeValidator.validate "Series.data", [NumDataSource], v
|
|
106
|
+
@data = v
|
|
107
|
+
end
|
|
105
108
|
|
|
106
109
|
# assigns the labels for this series
|
|
107
|
-
def labels=(v)
|
|
110
|
+
def labels=(v)
|
|
111
|
+
DataTypeValidator.validate "Series.labels", [AxDataSource], v
|
|
112
|
+
@labels = v
|
|
113
|
+
end
|
|
108
114
|
end
|
|
109
115
|
end
|
data/lib/axlsx/drawing/axes.rb
CHANGED
data/lib/axlsx/drawing/axis.rb
CHANGED
|
@@ -84,7 +84,7 @@ module Axlsx
|
|
|
84
84
|
|
|
85
85
|
# The color for this axis. This value is used when rendering the axis line in the chart.
|
|
86
86
|
# colors should be in 6 character rbg format
|
|
87
|
-
# @return [String] the rbg color
|
|
87
|
+
# @return [String] the rbg color assigned.
|
|
88
88
|
# @see color
|
|
89
89
|
def color=(color_rgb)
|
|
90
90
|
@color = color_rgb
|
|
@@ -99,29 +99,47 @@ module Axlsx
|
|
|
99
99
|
|
|
100
100
|
# The position of the axis
|
|
101
101
|
# must be one of [:l, :r, :t, :b]
|
|
102
|
-
def ax_pos=(v)
|
|
102
|
+
def ax_pos=(v)
|
|
103
|
+
RestrictionValidator.validate "#{self.class}.ax_pos", [:l, :r, :b, :t], v
|
|
104
|
+
@ax_pos = v
|
|
105
|
+
end
|
|
103
106
|
alias :axPos= :ax_pos=
|
|
104
107
|
|
|
105
108
|
# the position of the tick labels
|
|
106
109
|
# must be one of [:nextTo, :high, :low1]
|
|
107
|
-
def tick_lbl_pos=(v)
|
|
110
|
+
def tick_lbl_pos=(v)
|
|
111
|
+
RestrictionValidator.validate "#{self.class}.tick_lbl_pos", [:nextTo, :high, :low, :none], v
|
|
112
|
+
@tick_lbl_pos = v
|
|
113
|
+
end
|
|
108
114
|
alias :tickLblPos= :tick_lbl_pos=
|
|
109
115
|
|
|
110
116
|
# The number format format code for this axis
|
|
111
117
|
# default :General
|
|
112
|
-
def format_code=(v)
|
|
118
|
+
def format_code=(v)
|
|
119
|
+
Axlsx.validate_string(v)
|
|
120
|
+
@format_code = v
|
|
121
|
+
end
|
|
113
122
|
|
|
114
123
|
# Specify if gridlines should be shown for this axis
|
|
115
124
|
# default true
|
|
116
|
-
def gridlines=(v)
|
|
125
|
+
def gridlines=(v)
|
|
126
|
+
Axlsx.validate_boolean(v)
|
|
127
|
+
@gridlines = v
|
|
128
|
+
end
|
|
117
129
|
|
|
118
130
|
# Specify if axis should be removed from the chart
|
|
119
131
|
# default false
|
|
120
|
-
def delete=(v)
|
|
132
|
+
def delete=(v)
|
|
133
|
+
Axlsx.validate_boolean(v)
|
|
134
|
+
@delete = v
|
|
135
|
+
end
|
|
121
136
|
|
|
122
137
|
# specifies how the perpendicular axis is crossed
|
|
123
138
|
# must be one of [:autoZero, :min, :max]
|
|
124
|
-
def crosses=(v)
|
|
139
|
+
def crosses=(v)
|
|
140
|
+
RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v
|
|
141
|
+
@crosses = v
|
|
142
|
+
end
|
|
125
143
|
|
|
126
144
|
# Specify the degree of label rotation to apply to labels
|
|
127
145
|
# default true
|