caxlsx 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/examples/generate.rb +3 -1
  4. data/lib/axlsx/content_type/abstract_content_type.rb +4 -1
  5. data/lib/axlsx/content_type/content_type.rb +1 -1
  6. data/lib/axlsx/content_type/default.rb +4 -1
  7. data/lib/axlsx/content_type/override.rb +4 -1
  8. data/lib/axlsx/doc_props/app.rb +91 -24
  9. data/lib/axlsx/drawing/area_series.rb +8 -2
  10. data/lib/axlsx/drawing/axis.rb +24 -6
  11. data/lib/axlsx/drawing/bar_series.rb +12 -3
  12. data/lib/axlsx/drawing/cat_axis.rb +20 -5
  13. data/lib/axlsx/drawing/chart.rb +32 -8
  14. data/lib/axlsx/drawing/d_lbls.rb +4 -4
  15. data/lib/axlsx/drawing/drawing.rb +1 -0
  16. data/lib/axlsx/drawing/hyperlink.rb +12 -3
  17. data/lib/axlsx/drawing/line_series.rb +8 -2
  18. data/lib/axlsx/drawing/marker.rb +19 -4
  19. data/lib/axlsx/drawing/one_cell_anchor.rb +8 -2
  20. data/lib/axlsx/drawing/pic.rb +13 -4
  21. data/lib/axlsx/drawing/pie_3D_chart.rb +1 -1
  22. data/lib/axlsx/drawing/pie_chart.rb +36 -0
  23. data/lib/axlsx/drawing/pie_series.rb +16 -4
  24. data/lib/axlsx/drawing/scaling.rb +18 -4
  25. data/lib/axlsx/drawing/ser_axis.rb +8 -2
  26. data/lib/axlsx/drawing/series.rb +8 -2
  27. data/lib/axlsx/drawing/view_3D.rb +8 -2
  28. data/lib/axlsx/package.rb +4 -1
  29. data/lib/axlsx/rels/relationship.rb +13 -3
  30. data/lib/axlsx/rels/relationships.rb +1 -1
  31. data/lib/axlsx/stylesheet/border.rb +12 -3
  32. data/lib/axlsx/stylesheet/border_pr.rb +14 -3
  33. data/lib/axlsx/stylesheet/cell_alignment.rb +38 -9
  34. data/lib/axlsx/stylesheet/cell_protection.rb +9 -2
  35. data/lib/axlsx/stylesheet/cell_style.rb +29 -6
  36. data/lib/axlsx/stylesheet/color.rb +8 -2
  37. data/lib/axlsx/stylesheet/dxf.rb +29 -6
  38. data/lib/axlsx/stylesheet/fill.rb +4 -1
  39. data/lib/axlsx/stylesheet/font.rb +58 -12
  40. data/lib/axlsx/stylesheet/gradient_fill.rb +8 -2
  41. data/lib/axlsx/stylesheet/gradient_stop.rb +9 -2
  42. data/lib/axlsx/stylesheet/num_fmt.rb +8 -2
  43. data/lib/axlsx/stylesheet/pattern_fill.rb +14 -3
  44. data/lib/axlsx/stylesheet/styles.rb +57 -13
  45. data/lib/axlsx/stylesheet/table_style.rb +15 -4
  46. data/lib/axlsx/stylesheet/table_style_element.rb +12 -3
  47. data/lib/axlsx/stylesheet/table_styles.rb +10 -3
  48. data/lib/axlsx/stylesheet/xf.rb +68 -15
  49. data/lib/axlsx/util/accessors.rb +8 -6
  50. data/lib/axlsx/util/storage.rb +1 -1
  51. data/lib/axlsx/version.rb +1 -1
  52. data/lib/axlsx/workbook/defined_names.rb +1 -1
  53. data/lib/axlsx/workbook/workbook.rb +19 -6
  54. data/lib/axlsx/workbook/workbook_views.rb +1 -1
  55. data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +4 -2
  56. data/lib/axlsx/workbook/worksheet/cell.rb +30 -10
  57. data/lib/axlsx/workbook/worksheet/cfvo.rb +8 -2
  58. data/lib/axlsx/workbook/worksheet/col_breaks.rb +1 -1
  59. data/lib/axlsx/workbook/worksheet/cols.rb +1 -1
  60. data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +8 -2
  61. data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +69 -14
  62. data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +1 -1
  63. data/lib/axlsx/workbook/worksheet/data_validation.rb +52 -13
  64. data/lib/axlsx/workbook/worksheet/data_validations.rb +1 -1
  65. data/lib/axlsx/workbook/worksheet/icon_set.rb +16 -4
  66. data/lib/axlsx/workbook/worksheet/merged_cells.rb +1 -1
  67. data/lib/axlsx/workbook/worksheet/page_margins.rb +30 -7
  68. data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +1 -2
  69. data/lib/axlsx/workbook/worksheet/page_setup.rb +30 -7
  70. data/lib/axlsx/workbook/worksheet/pane.rb +8 -2
  71. data/lib/axlsx/workbook/worksheet/pivot_tables.rb +1 -1
  72. data/lib/axlsx/workbook/worksheet/protected_ranges.rb +1 -1
  73. data/lib/axlsx/workbook/worksheet/rich_text_run.rb +30 -10
  74. data/lib/axlsx/workbook/worksheet/row.rb +5 -2
  75. data/lib/axlsx/workbook/worksheet/row_breaks.rb +1 -1
  76. data/lib/axlsx/workbook/worksheet/selection.rb +8 -2
  77. data/lib/axlsx/workbook/worksheet/sheet_protection.rb +1 -1
  78. data/lib/axlsx/workbook/worksheet/sheet_view.rb +30 -9
  79. data/lib/axlsx/workbook/worksheet/table_style_info.rb +1 -1
  80. data/lib/axlsx/workbook/worksheet/tables.rb +1 -1
  81. data/lib/axlsx/workbook/worksheet/worksheet.rb +18 -2
  82. data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +1 -1
  83. data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +1 -1
  84. metadata +6 -44
@@ -7,7 +7,7 @@ module Axlsx
7
7
  def initialize(worksheet)
8
8
  raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
9
9
 
10
- super Table
10
+ super(Table)
11
11
  @worksheet = worksheet
12
12
  end
13
13
 
@@ -35,7 +35,7 @@ module Axlsx
35
35
  # @param [Hash] options Options passed in from the initializer
36
36
  def initialize_page_options(options)
37
37
  @page_margins = PageMargins.new options[:page_margins] if options[:page_margins]
38
- @page_setup = PageSetup.new options[:page_setup] if options[:page_setup]
38
+ @page_setup = PageSetup.new options[:page_setup] if options[:page_setup]
39
39
  @print_options = PrintOptions.new options[:print_options] if options[:print_options]
40
40
  @header_footer = HeaderFooter.new options[:header_footer] if options[:header_footer]
41
41
  @row_breaks = RowBreaks.new
@@ -552,6 +552,19 @@ module Axlsx
552
552
  end
553
553
  end
554
554
 
555
+ # This is a helper method that lets you specify a default style for multiple columns in a worksheet in one go.
556
+ # This style will be applied for all not-yet-defined cells in a column.
557
+ # Note that you must call column_styles BEFORE adding data, otherwise the styles will not be set successfully for new cells.
558
+ # @param [Integer] styles the cellXfs indexes
559
+ def column_styles(*styles)
560
+ styles.each_with_index do |style, index|
561
+ next if style.nil?
562
+
563
+ Axlsx.validate_unsigned_int(style)
564
+ find_or_create_column_info(index).style = style
565
+ end
566
+ end
567
+
555
568
  # Set the style for cells in a specific column
556
569
  # @param [Integer] index the index of the column
557
570
  # @param [Integer] style the cellXfs index
@@ -833,7 +846,10 @@ module Axlsx
833
846
  @worksheet_comments ||= WorksheetComments.new self
834
847
  end
835
848
 
836
- def workbook=(v) DataTypeValidator.validate "Worksheet.workbook", Workbook, v; @workbook = v; end
849
+ def workbook=(v)
850
+ DataTypeValidator.validate "Worksheet.workbook", Workbook, v
851
+ @workbook = v
852
+ end
837
853
 
838
854
  def update_column_info(cells, widths = nil)
839
855
  cells.each_with_index do |cell, index|
@@ -60,7 +60,7 @@ module Axlsx
60
60
  # @return [String]
61
61
  def to_xml_string(str = +'')
62
62
  str << '<hyperlink '
63
- serialized_attributes str, location_or_id
63
+ serialized_attributes str, location_or_id, false
64
64
  str << '/>'
65
65
  end
66
66
 
@@ -8,7 +8,7 @@ module Axlsx
8
8
  def initialize(worksheet)
9
9
  DataTypeValidator.validate "Hyperlinks.worksheet", [Worksheet], worksheet
10
10
  @worksheet = worksheet
11
- super WorksheetHyperlink
11
+ super(WorksheetHyperlink)
12
12
  end
13
13
 
14
14
  # Creates and adds a new hyperlink based on the options provided
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caxlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randy Morgan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-10-30 00:00:00.000000000 Z
12
+ date: 2024-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: htmlentities
@@ -85,48 +85,6 @@ dependencies:
85
85
  - - "<"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '3'
88
- - !ruby/object:Gem::Dependency
89
- name: kramdown
90
- requirement: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '2.3'
95
- type: :development
96
- prerelease: false
97
- version_requirements: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - "~>"
100
- - !ruby/object:Gem::Version
101
- version: '2.3'
102
- - !ruby/object:Gem::Dependency
103
- name: timecop
104
- requirement: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - "~>"
107
- - !ruby/object:Gem::Version
108
- version: 0.9.0
109
- type: :development
110
- prerelease: false
111
- version_requirements: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - "~>"
114
- - !ruby/object:Gem::Version
115
- version: 0.9.0
116
- - !ruby/object:Gem::Dependency
117
- name: yard
118
- requirement: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: 0.9.8
123
- type: :development
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: 0.9.8
130
88
  description: 'xlsx spreadsheet generation with charts, images, automated column width,
131
89
  customizable styles and full schema validation. Axlsx helps you create beautiful
132
90
  Office Open XML Spreadsheet documents (Excel, Google Spreadsheets, Numbers, LibreOffice)
@@ -183,6 +141,7 @@ files:
183
141
  - lib/axlsx/drawing/pic.rb
184
142
  - lib/axlsx/drawing/picture_locking.rb
185
143
  - lib/axlsx/drawing/pie_3D_chart.rb
144
+ - lib/axlsx/drawing/pie_chart.rb
186
145
  - lib/axlsx/drawing/pie_series.rb
187
146
  - lib/axlsx/drawing/scaling.rb
188
147
  - lib/axlsx/drawing/scatter_chart.rb
@@ -334,6 +293,9 @@ homepage: https://github.com/caxlsx/caxlsx
334
293
  licenses:
335
294
  - MIT
336
295
  metadata:
296
+ bug_tracker_uri: https://github.com/caxlsx/caxlsx/issues
297
+ changelog_uri: https://github.com/caxlsx/caxlsx/blob/master/CHANGELOG.md
298
+ source_code_uri: https://github.com/caxlsx/caxlsx
337
299
  rubygems_mfa_required: 'true'
338
300
  post_install_message:
339
301
  rdoc_options: []