caxlsx 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -12
- data/README.md +1 -1
- 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 +3 -3
- data/lib/axlsx/drawing/bar_chart.rb +3 -3
- 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 +32 -8
- data/lib/axlsx/drawing/d_lbls.rb +8 -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/package.rb +11 -11
- 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 +15 -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 +14 -3
- data/lib/axlsx/stylesheet/styles.rb +83 -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/xf.rb +69 -16
- data/lib/axlsx/util/accessors.rb +9 -7
- data/lib/axlsx/util/constants.rb +2 -2
- data/lib/axlsx/util/serialized_attributes.rb +2 -2
- data/lib/axlsx/util/simple_typed_list.rb +25 -12
- data/lib/axlsx/util/storage.rb +4 -4
- data/lib/axlsx/util/validators.rb +1 -1
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/defined_name.rb +1 -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 +80 -67
- 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 +3 -3
- 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 +37 -17
- 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 +22 -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/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 +8 -2
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +29 -5
- data/lib/axlsx/workbook/worksheet/pivot_tables.rb +1 -1
- 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_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 +2 -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 +3 -3
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +2 -2
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +2 -2
- data/lib/axlsx.rb +44 -30
- data/lib/caxlsx.rb +1 -1
- metadata +10 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b15095b3a73b9f2e11f59bb674964ce206e11e699937e109831d9422fd26750f
|
4
|
+
data.tar.gz: e20e938a224f9da043fd4c7cfcd2c35af03a5bb037fc9164a59c44c110e3e248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cdd4b3843dd886f864212ecb4a40f528543d4fd1c682079c5497d3c40ea684bc64d214db4a974d3cea2071663bc3cfbd501543d6868077d9b369340c751bd90
|
7
|
+
data.tar.gz: 520da353dfbc0022ac6a3aae5006e669fd6f291aad95797b2ff24a2cf1634de4f66c52616efa2af5bfbd7524cf91393d56a6e6a433131f988402e277cacbaca5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@ CHANGELOG
|
|
2
2
|
---------
|
3
3
|
- **Unreleased**
|
4
4
|
|
5
|
+
- **December.15.24**: 4.2.0
|
6
|
+
- [PR #359](https://github.com/caxlsx/caxlsx/pull/359) Add `PivotTable#grand_totals` option to remove grand totals row/col
|
7
|
+
- [PR #362](https://github.com/caxlsx/caxlsx/pull/362) Use widest width even if provided as fixed value
|
8
|
+
- [PR #398](https://github.com/caxlsx/caxlsx/pull/398) Add `Axlsx#uri_parser` method for RFC2396 compatibility
|
9
|
+
- [PR #390](https://github.com/caxlsx/caxlsx/pull/390) Change ISO_8601_REGEX to match how Excel handles ISO 8601 formats
|
10
|
+
- [PR #402](https://github.com/caxlsx/caxlsx/pull/402) Refactor `Axlsx::SimpleTypedList` to better match `Array` API
|
11
|
+
- [PR #409](https://github.com/caxlsx/caxlsx/pull/409) Prefer `require_relative` for internal requires
|
12
|
+
- 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))
|
13
|
+
|
14
|
+
- **February.26.24**: 4.1.0
|
15
|
+
- [PR #316](https://github.com/caxlsx/caxlsx/pull/316) Prevent camelization of hyperlink locations
|
16
|
+
- [PR #312](https://github.com/caxlsx/caxlsx/pull/312) Added 2D/flat PieChart drawing
|
17
|
+
- [PR #317](https://github.com/caxlsx/caxlsx/pull/317) Apply style for columns without defining cells
|
18
|
+
- [PR #345](https://github.com/caxlsx/caxlsx/pull/345) Show outline symbols by default to match original behavior
|
19
|
+
- [PR #334](https://github.com/caxlsx/caxlsx/pull/334) Add pattern fill options to add_style
|
20
|
+
- [PR #342](https://github.com/caxlsx/caxlsx/pull/342) Fix show button for filter columns
|
21
|
+
- [PR #349](https://github.com/caxlsx/caxlsx/pull/349) Convert test suite to Minitest
|
5
22
|
|
6
23
|
- **October.30.23**: 4.0.0
|
7
24
|
- [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 +40,7 @@ CHANGELOG
|
|
23
40
|
- [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
41
|
- Fix bug when calling `worksheet.add_border("A1:B2", nil)`
|
25
42
|
- Change `BorderCreator#initialize` arguments handling
|
26
|
-
- Fix `add_border` to work with
|
43
|
+
- Fix `add_border` to work with singular cell refs
|
27
44
|
- [PR #196](https://github.com/caxlsx/caxlsx/pull/196) - Fix tab color reassignment
|
28
45
|
- Add support for remote image source in `Pic` using External Relationship (supported in Excel documents)
|
29
46
|
|
@@ -157,7 +174,7 @@ CHANGELOG
|
|
157
174
|
and charts to the same worksheet drawing.
|
158
175
|
- Added outline_level_rows and outline_level_columns to worksheet to simplify setting up outlining in the worksheet.
|
159
176
|
- Added support for pivot tables
|
160
|
-
- Added support for
|
177
|
+
- Added support for discrete border edge styles
|
161
178
|
- Improved validation of sheet names
|
162
179
|
- 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
180
|
|
@@ -189,7 +206,7 @@ CHANGELOG
|
|
189
206
|
from the initial master.
|
190
207
|
|
191
208
|
- **September.8.12**: 1.2.3
|
192
|
-
- enhance exponential float/bigdecimal values rendering as strings
|
209
|
+
- enhance exponential float/bigdecimal values rendering as strings instead
|
193
210
|
of 'numbers' in excel.
|
194
211
|
- added support for :none option on chart axis labels
|
195
212
|
- added support for paper_size option on worksheet.page_setup
|
@@ -223,14 +240,14 @@ CHANGELOG
|
|
223
240
|
- added in interop requirements so that charts are properly exported
|
224
241
|
to PDF from Libra Office
|
225
242
|
- various readability improvements and work standardizing attribute
|
226
|
-
names to snake_case. Aliases are provided for backward
|
243
|
+
names to snake_case. Aliases are provided for backward compatibility
|
227
244
|
|
228
245
|
- **June.11.12**: 1.1.7
|
229
246
|
- fix chart rendering issue when label offset is specified as a
|
230
247
|
percentage in serialization and ensure that formula are not stored
|
231
248
|
in value caches
|
232
249
|
- fix bug that causes repair warnings when using a text only title reference.
|
233
|
-
- Add title property to axis so you can
|
250
|
+
- Add title property to axis so you can label the x/y/series axis for
|
234
251
|
charts.
|
235
252
|
- Add sheet views with panes
|
236
253
|
|
@@ -240,14 +257,14 @@ in value caches
|
|
240
257
|
- added support for two cell anchors for images
|
241
258
|
- test coverage now back up to 100%
|
242
259
|
- bugfix for merge cell sorting algorithm
|
243
|
-
- added fit_to method for page_setup to simplify managing
|
260
|
+
- added fit_to method for page_setup to simplify managing width/height
|
244
261
|
- added ph (phonetics) and s (style) attributes for row.
|
245
262
|
- resolved all warnings generating from this gem.
|
246
263
|
- improved comment relationship management for multiple comments
|
247
264
|
|
248
265
|
- **May.13.12**: 1.1.5
|
249
266
|
- MOAR print options! You can now specify paper size, orientation,
|
250
|
-
fit to width, page
|
267
|
+
fit to width, page margins and gridlines for printing.
|
251
268
|
- Support for adding comments to your worksheets
|
252
269
|
- bugfix for applying style to empty cells
|
253
270
|
- bugfix for parsing formula with multiple '='
|
@@ -322,7 +339,7 @@ in value caches
|
|
322
339
|
|
323
340
|
- **January.6.12**: 1.0.15
|
324
341
|
https://github.com/randym/axlsx/compare/1.0.14...1.0.15
|
325
|
-
- Bug fix add_style specified number formats must be
|
342
|
+
- Bug fix add_style specified number formats must be explicitly applied for libraOffice
|
326
343
|
- performance improvements from ochko when creating cells with options.
|
327
344
|
- 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
345
|
- Release in preparation for password protection merge
|
@@ -354,7 +371,7 @@ in value caches
|
|
354
371
|
- **October.30.11**: 1.0.10
|
355
372
|
- Updating gemspec to lower gem version requirements.
|
356
373
|
- Added row.style assignation for updating the cell style for an entire row
|
357
|
-
- Added col_style method to worksheet
|
374
|
+
- Added col_style method to worksheet update a the style for a column of cells
|
358
375
|
- Added cols for an easy reference to columns in a worksheet.
|
359
376
|
- prep for pre release of acts_as_xlsx gem
|
360
377
|
- added in travis.ci configuration and build status
|
@@ -369,14 +386,14 @@ in value caches
|
|
369
386
|
- Added support for images (jpg, gif, png) in worksheets.
|
370
387
|
|
371
388
|
- **October.23.11**: 1.0.7 released
|
372
|
-
- Added support for 3D options when creating a new chart. This lets you set the
|
389
|
+
- 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
390
|
- Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
|
374
391
|
- updated rake to include build, genoc and deploy tasks.
|
375
392
|
- rebuilt documentation.
|
376
393
|
- moved version constant to its own file
|
377
394
|
- fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
|
378
395
|
- Review and improve docs
|
379
|
-
- rebuild of anchor positioning to remove some
|
396
|
+
- 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
397
|
- Refactored cat and val axis data to keep series serialization a bit more DRY
|
381
398
|
|
382
399
|
- **October.22.11**: 1.0.6
|
@@ -396,7 +413,7 @@ in value caches
|
|
396
413
|
- BugFix: shape attribute for bar chart is now properly serialized
|
397
414
|
- BugFix: date1904 property now properly set for charts
|
398
415
|
- Added style property to charts
|
399
|
-
- Removed serialization write test as it most commonly fails when run from the gem's
|
416
|
+
- Removed serialization write test as it most commonly fails when run from the gem's installed directory
|
400
417
|
|
401
418
|
- **October.21.11**: 1.0.4
|
402
419
|
- altered package to accept a filename string for serialization instead of a File object.
|
data/README.md
CHANGED
@@ -107,7 +107,7 @@ Additional documentation is listed below:
|
|
107
107
|
- [Style Reference](https://github.com/caxlsx/caxlsx/blob/master/docs/style_reference.md)
|
108
108
|
- [Header and Footer Codes](https://github.com/caxlsx/caxlsx/blob/master/docs/header_and_footer_codes.md)
|
109
109
|
|
110
|
-
⚠ 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
|
110
|
+
⚠ 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
111
|
|
112
112
|
Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest.
|
113
113
|
|
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
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The Bar3DChart is a three
|
4
|
+
# The Bar3DChart is a three dimensional barchart (who would have guessed?) that you can add to your worksheet.
|
5
5
|
# @see Worksheet#add_chart
|
6
6
|
# @see Chart#add_series
|
7
7
|
# @see Package#serialize
|
@@ -75,7 +75,7 @@ module Axlsx
|
|
75
75
|
def initialize(frame, options = {})
|
76
76
|
@vary_colors = true
|
77
77
|
@gap_width, @gap_depth, @shape = nil, nil, nil
|
78
|
-
super
|
78
|
+
super
|
79
79
|
@series_type = BarSeries
|
80
80
|
@view_3D = View3D.new({ r_ang_ax: 1 }.merge(options))
|
81
81
|
@d_lbls = nil
|
@@ -121,7 +121,7 @@ module Axlsx
|
|
121
121
|
# @param [String] str
|
122
122
|
# @return [String]
|
123
123
|
def to_xml_string(str = +'')
|
124
|
-
super
|
124
|
+
super do
|
125
125
|
str << '<c:bar3DChart>'
|
126
126
|
str << '<c:barDir val="' << bar_dir.to_s << '"/>'
|
127
127
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The BarChart is a two
|
4
|
+
# The BarChart is a two dimensional barchart that you can add to your worksheet.
|
5
5
|
# @see Worksheet#add_chart
|
6
6
|
# @see Chart#add_series
|
7
7
|
# @see Package#serialize
|
@@ -68,7 +68,7 @@ module Axlsx
|
|
68
68
|
def initialize(frame, options = {})
|
69
69
|
@vary_colors = true
|
70
70
|
@gap_width, @overlap, @shape = nil, nil, nil
|
71
|
-
super
|
71
|
+
super
|
72
72
|
@series_type = BarSeries
|
73
73
|
@d_lbls = nil
|
74
74
|
end
|
@@ -111,7 +111,7 @@ module Axlsx
|
|
111
111
|
# @param [String] str
|
112
112
|
# @return [String]
|
113
113
|
def to_xml_string(str = +'')
|
114
|
-
super
|
114
|
+
super do
|
115
115
|
str << '<c:barChart>'
|
116
116
|
str << '<c:barDir val="' << bar_dir.to_s << '"/>'
|
117
117
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|