caxlsx 4.0.0 → 4.2.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.
- 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
|
@@ -56,7 +56,10 @@ module Axlsx
|
|
|
56
56
|
attr_reader :interpolationPoints
|
|
57
57
|
|
|
58
58
|
# @see iconSet
|
|
59
|
-
def iconSet=(v)
|
|
59
|
+
def iconSet=(v)
|
|
60
|
+
Axlsx.validate_icon_set(v)
|
|
61
|
+
@iconSet = v
|
|
62
|
+
end
|
|
60
63
|
|
|
61
64
|
# @see interpolationPoints
|
|
62
65
|
def interpolationPoints=(v)
|
|
@@ -66,13 +69,22 @@ module Axlsx
|
|
|
66
69
|
end
|
|
67
70
|
|
|
68
71
|
# @see showValue
|
|
69
|
-
def showValue=(v)
|
|
72
|
+
def showValue=(v)
|
|
73
|
+
Axlsx.validate_boolean(v)
|
|
74
|
+
@showValue = v
|
|
75
|
+
end
|
|
70
76
|
|
|
71
77
|
# @see percent
|
|
72
|
-
def percent=(v)
|
|
78
|
+
def percent=(v)
|
|
79
|
+
Axlsx.validate_boolean(v)
|
|
80
|
+
@percent = v
|
|
81
|
+
end
|
|
73
82
|
|
|
74
83
|
# @see reverse
|
|
75
|
-
def reverse=(v)
|
|
84
|
+
def reverse=(v)
|
|
85
|
+
Axlsx.validate_boolean(v)
|
|
86
|
+
@reverse = v
|
|
87
|
+
end
|
|
76
88
|
|
|
77
89
|
# Serialize this object to an xml string
|
|
78
90
|
# @param [String] str
|
|
@@ -87,7 +99,7 @@ module Axlsx
|
|
|
87
99
|
|
|
88
100
|
private
|
|
89
101
|
|
|
90
|
-
#
|
|
102
|
+
# Initialize the simple typed list of value objects
|
|
91
103
|
def initialize_value_objects
|
|
92
104
|
@value_objects = SimpleTypedList.new Cfvo
|
|
93
105
|
@interpolationPoints.each { |point| @value_objects << Cfvo.new(type: :percent, val: point) }
|
|
@@ -13,7 +13,7 @@ module Axlsx
|
|
|
13
13
|
:apply_styles
|
|
14
14
|
|
|
15
15
|
# These attributes are all boolean so I'm doing a bit of a hand
|
|
16
|
-
# waving magic show to set up the
|
|
16
|
+
# waving magic show to set up the attribute accessors
|
|
17
17
|
boolean_attr_accessor :summary_below,
|
|
18
18
|
:summary_right,
|
|
19
19
|
:apply_styles
|
|
@@ -73,22 +73,45 @@ module Axlsx
|
|
|
73
73
|
margins.select do |k, v|
|
|
74
74
|
next unless MARGIN_KEYS.include? k
|
|
75
75
|
|
|
76
|
-
send("#{k}=", v)
|
|
76
|
+
send(:"#{k}=", v)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
# @see left
|
|
81
|
-
def left=(v)
|
|
81
|
+
def left=(v)
|
|
82
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
83
|
+
@left = v
|
|
84
|
+
end
|
|
85
|
+
|
|
82
86
|
# @see right
|
|
83
|
-
def right=(v)
|
|
87
|
+
def right=(v)
|
|
88
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
89
|
+
@right = v
|
|
90
|
+
end
|
|
91
|
+
|
|
84
92
|
# @see top
|
|
85
|
-
def top=(v)
|
|
93
|
+
def top=(v)
|
|
94
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
95
|
+
@top = v
|
|
96
|
+
end
|
|
97
|
+
|
|
86
98
|
# @see bottom
|
|
87
|
-
def bottom=(v)
|
|
99
|
+
def bottom=(v)
|
|
100
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
101
|
+
@bottom = v
|
|
102
|
+
end
|
|
103
|
+
|
|
88
104
|
# @see header
|
|
89
|
-
def header=(v)
|
|
105
|
+
def header=(v)
|
|
106
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
107
|
+
@header = v
|
|
108
|
+
end
|
|
109
|
+
|
|
90
110
|
# @see footer
|
|
91
|
-
def footer=(v)
|
|
111
|
+
def footer=(v)
|
|
112
|
+
Axlsx.validate_unsigned_numeric(v)
|
|
113
|
+
@footer = v
|
|
114
|
+
end
|
|
92
115
|
|
|
93
116
|
# Serializes the page margins element
|
|
94
117
|
# @param [String] str
|
|
@@ -17,8 +17,7 @@ module Axlsx
|
|
|
17
17
|
|
|
18
18
|
serializable_attributes :auto_page_breaks, :fit_to_page
|
|
19
19
|
|
|
20
|
-
attr_reader :auto_page_breaks
|
|
21
|
-
attr_reader :fit_to_page
|
|
20
|
+
attr_reader :auto_page_breaks, :fit_to_page
|
|
22
21
|
|
|
23
22
|
# Flag indicating whether the Fit to Page print option is enabled.
|
|
24
23
|
# @param [Boolean] value
|
|
@@ -38,13 +38,13 @@ module Axlsx
|
|
|
38
38
|
# * verticalDpi
|
|
39
39
|
|
|
40
40
|
# Number of vertical pages to fit on.
|
|
41
|
-
# @note PageSetup#fit_to is the
|
|
41
|
+
# @note PageSetup#fit_to is the recommended way to manage page fitting as only specifying one of fit_to_width/fit_to_height will result in the counterpart
|
|
42
42
|
# being set to 1.
|
|
43
43
|
# @return [Integer]
|
|
44
44
|
attr_reader :fit_to_height
|
|
45
45
|
|
|
46
46
|
# Number of horizontal pages to fit on.
|
|
47
|
-
# @note PageSetup#fit_to is the
|
|
47
|
+
# @note PageSetup#fit_to is the recommended way to manage page fitting as only specifying one of width/height will result in the counterpart
|
|
48
48
|
# being set to 1.
|
|
49
49
|
# @return [Integer]
|
|
50
50
|
attr_reader :fit_to_width
|
|
@@ -198,17 +198,40 @@ module Axlsx
|
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
# @see fit_to_height
|
|
201
|
-
def fit_to_height=(v)
|
|
201
|
+
def fit_to_height=(v)
|
|
202
|
+
Axlsx.validate_unsigned_int(v)
|
|
203
|
+
@fit_to_height = v
|
|
204
|
+
end
|
|
205
|
+
|
|
202
206
|
# @see fit_to_width
|
|
203
|
-
def fit_to_width=(v)
|
|
207
|
+
def fit_to_width=(v)
|
|
208
|
+
Axlsx.validate_unsigned_int(v)
|
|
209
|
+
@fit_to_width = v
|
|
210
|
+
end
|
|
211
|
+
|
|
204
212
|
# @see orientation
|
|
205
|
-
def orientation=(v)
|
|
213
|
+
def orientation=(v)
|
|
214
|
+
Axlsx.validate_page_orientation(v)
|
|
215
|
+
@orientation = v
|
|
216
|
+
end
|
|
217
|
+
|
|
206
218
|
# @see paper_height
|
|
207
|
-
def paper_height=(v)
|
|
219
|
+
def paper_height=(v)
|
|
220
|
+
Axlsx.validate_number_with_unit(v)
|
|
221
|
+
@paper_height = v
|
|
222
|
+
end
|
|
223
|
+
|
|
208
224
|
# @see paper_width
|
|
209
|
-
def paper_width=(v)
|
|
225
|
+
def paper_width=(v)
|
|
226
|
+
Axlsx.validate_number_with_unit(v)
|
|
227
|
+
@paper_width = v
|
|
228
|
+
end
|
|
229
|
+
|
|
210
230
|
# @see scale
|
|
211
|
-
def scale=(v)
|
|
231
|
+
def scale=(v)
|
|
232
|
+
Axlsx.validate_scale_10_400(v)
|
|
233
|
+
@scale = v
|
|
234
|
+
end
|
|
212
235
|
|
|
213
236
|
# convenience method to achieve sanity when setting fit_to_width and fit_to_height
|
|
214
237
|
# as they both default to 1 if only their counterpart is specified.
|
|
@@ -226,7 +249,7 @@ module Axlsx
|
|
|
226
249
|
# @return [Boolean]
|
|
227
250
|
def fit_to_page?
|
|
228
251
|
# is there some better way to express this?
|
|
229
|
-
|
|
252
|
+
!fit_to_width.nil? || !fit_to_height.nil?
|
|
230
253
|
end
|
|
231
254
|
|
|
232
255
|
# Serializes the page settings element.
|
|
@@ -114,10 +114,16 @@ module Axlsx
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
# @see x_split
|
|
117
|
-
def x_split=(v)
|
|
117
|
+
def x_split=(v)
|
|
118
|
+
Axlsx.validate_unsigned_int(v)
|
|
119
|
+
@x_split = v
|
|
120
|
+
end
|
|
118
121
|
|
|
119
122
|
# @see y_split
|
|
120
|
-
def y_split=(v)
|
|
123
|
+
def y_split=(v)
|
|
124
|
+
Axlsx.validate_unsigned_int(v)
|
|
125
|
+
@y_split = v
|
|
126
|
+
end
|
|
121
127
|
|
|
122
128
|
# Serializes the data validation
|
|
123
129
|
# @param [String] str
|
|
@@ -26,6 +26,7 @@ module Axlsx
|
|
|
26
26
|
@pages = []
|
|
27
27
|
@subtotal = nil
|
|
28
28
|
@no_subtotals_on_headers = []
|
|
29
|
+
@grand_totals = :both
|
|
29
30
|
@sort_on_headers = {}
|
|
30
31
|
@style_info = {}
|
|
31
32
|
parse_options options
|
|
@@ -51,6 +52,19 @@ module Axlsx
|
|
|
51
52
|
@sort_on_headers = headers
|
|
52
53
|
end
|
|
53
54
|
|
|
55
|
+
# Defines which Grand Totals are to be shown.
|
|
56
|
+
# @return [Symbol] The row and/or column Grand Totals that are to be shown.
|
|
57
|
+
# Defaults to `:both` to show both row & column grand totals.
|
|
58
|
+
# Set to `:row_only`, `:col_only`, or `:none` to hide one or both Grand Totals.
|
|
59
|
+
attr_reader :grand_totals
|
|
60
|
+
|
|
61
|
+
# (see #grand_totals)
|
|
62
|
+
def grand_totals=(value)
|
|
63
|
+
RestrictionValidator.validate "PivotTable.grand_totals", [:both, :row_only, :col_only, :none], value
|
|
64
|
+
|
|
65
|
+
@grand_totals = value
|
|
66
|
+
end
|
|
67
|
+
|
|
54
68
|
# Style info for the pivot table
|
|
55
69
|
# @return [Hash]
|
|
56
70
|
attr_accessor :style_info
|
|
@@ -114,7 +128,8 @@ module Axlsx
|
|
|
114
128
|
@columns = v
|
|
115
129
|
end
|
|
116
130
|
|
|
117
|
-
# The data
|
|
131
|
+
# The data as an array of either headers (String) or hashes or mix of the two.
|
|
132
|
+
# Hash in format of { ref: header, num_fmt: numFmts, subtotal: subtotal }, where header is String, numFmts is Integer, and subtotal one of %w[sum count average max min product countNums stdDev stdDevp var varp]; leave subtotal blank to sum values
|
|
118
133
|
# @return [Array]
|
|
119
134
|
attr_reader :data
|
|
120
135
|
|
|
@@ -188,7 +203,11 @@ module Axlsx
|
|
|
188
203
|
def to_xml_string(str = +'')
|
|
189
204
|
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
|
190
205
|
|
|
191
|
-
str << '<pivotTableDefinition xmlns="' << XML_NS << '" name="' << name << '" cacheId="' << cache_definition.cache_id.to_s << '"'
|
|
206
|
+
str << '<pivotTableDefinition xmlns="' << XML_NS << '" name="' << name << '" cacheId="' << cache_definition.cache_id.to_s << '"'
|
|
207
|
+
str << ' dataOnRows="1"' if data.size <= 1
|
|
208
|
+
str << ' rowGrandTotals="0"' if grand_totals == :col_only || grand_totals == :none
|
|
209
|
+
str << ' colGrandTotals="0"' if grand_totals == :row_only || grand_totals == :none
|
|
210
|
+
str << ' applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Data" showMultipleLabel="0" showMemberPropertyTips="0" useAutoFormatting="1" indent="0" compact="0" compactData="0" gridDropZones="1" multipleFieldFilters="0">'
|
|
192
211
|
|
|
193
212
|
str << '<location firstDataCol="1" firstDataRow="1" firstHeaderRow="1" ref="' << ref << '"/>'
|
|
194
213
|
str << '<pivotFields count="' << header_cells_count.to_s << '">'
|
|
@@ -244,8 +263,9 @@ module Axlsx
|
|
|
244
263
|
unless data.empty?
|
|
245
264
|
str << "<dataFields count=\"#{data.size}\">"
|
|
246
265
|
data.each do |datum_value|
|
|
247
|
-
|
|
248
|
-
|
|
266
|
+
subtotal_name = datum_value[:subtotal] || 'sum'
|
|
267
|
+
subtotal_name = 'count' if name == 'countNums' # both count & countNums are labelled as count
|
|
268
|
+
str << "<dataField name='#{subtotal_name.capitalize} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
|
|
249
269
|
str << " numFmtId='#{datum_value[:num_fmt]}'" if datum_value[:num_fmt]
|
|
250
270
|
str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
|
|
251
271
|
str << "/>"
|
|
@@ -311,7 +331,11 @@ module Axlsx
|
|
|
311
331
|
elsif columns.include? cell_ref
|
|
312
332
|
attributes << 'axis="axisCol"'
|
|
313
333
|
attributes << "sortType=\"#{sorttype == :descending ? 'descending' : 'ascending'}\"" if sorttype
|
|
314
|
-
|
|
334
|
+
if subtotal
|
|
335
|
+
include_items_tag = true
|
|
336
|
+
else
|
|
337
|
+
attributes << 'defaultSubtotal="0"'
|
|
338
|
+
end
|
|
315
339
|
elsif pages.include? cell_ref
|
|
316
340
|
attributes << 'axis="axisPage"'
|
|
317
341
|
include_items_tag = true
|
|
@@ -29,7 +29,9 @@ module Axlsx
|
|
|
29
29
|
attr_reader :font_name
|
|
30
30
|
|
|
31
31
|
# @see font_name
|
|
32
|
-
def font_name=(v)
|
|
32
|
+
def font_name=(v)
|
|
33
|
+
set_run_style :validate_string, :font_name, v
|
|
34
|
+
end
|
|
33
35
|
|
|
34
36
|
# The inline charset property for the cell
|
|
35
37
|
# As far as I can tell, this is pretty much ignored. However, based on the spec it should be one of the following:
|
|
@@ -56,7 +58,9 @@ module Axlsx
|
|
|
56
58
|
attr_reader :charset
|
|
57
59
|
|
|
58
60
|
# @see charset
|
|
59
|
-
def charset=(v)
|
|
61
|
+
def charset=(v)
|
|
62
|
+
set_run_style :validate_unsigned_int, :charset, v
|
|
63
|
+
end
|
|
60
64
|
|
|
61
65
|
# The inline family property for the cell
|
|
62
66
|
# @return [Integer]
|
|
@@ -77,55 +81,69 @@ module Axlsx
|
|
|
77
81
|
attr_reader :b
|
|
78
82
|
|
|
79
83
|
# @see b
|
|
80
|
-
def b=(v)
|
|
84
|
+
def b=(v)
|
|
85
|
+
set_run_style :validate_boolean, :b, v
|
|
86
|
+
end
|
|
81
87
|
|
|
82
88
|
# The inline italic property for the cell
|
|
83
89
|
# @return [Boolean]
|
|
84
90
|
attr_reader :i
|
|
85
91
|
|
|
86
92
|
# @see i
|
|
87
|
-
def i=(v)
|
|
93
|
+
def i=(v)
|
|
94
|
+
set_run_style :validate_boolean, :i, v
|
|
95
|
+
end
|
|
88
96
|
|
|
89
97
|
# The inline strike property for the cell
|
|
90
98
|
# @return [Boolean]
|
|
91
99
|
attr_reader :strike
|
|
92
100
|
|
|
93
101
|
# @see strike
|
|
94
|
-
def strike=(v)
|
|
102
|
+
def strike=(v)
|
|
103
|
+
set_run_style :validate_boolean, :strike, v
|
|
104
|
+
end
|
|
95
105
|
|
|
96
106
|
# The inline outline property for the cell
|
|
97
107
|
# @return [Boolean]
|
|
98
108
|
attr_reader :outline
|
|
99
109
|
|
|
100
110
|
# @see outline
|
|
101
|
-
def outline=(v)
|
|
111
|
+
def outline=(v)
|
|
112
|
+
set_run_style :validate_boolean, :outline, v
|
|
113
|
+
end
|
|
102
114
|
|
|
103
115
|
# The inline shadow property for the cell
|
|
104
116
|
# @return [Boolean]
|
|
105
117
|
attr_reader :shadow
|
|
106
118
|
|
|
107
119
|
# @see shadow
|
|
108
|
-
def shadow=(v)
|
|
120
|
+
def shadow=(v)
|
|
121
|
+
set_run_style :validate_boolean, :shadow, v
|
|
122
|
+
end
|
|
109
123
|
|
|
110
124
|
# The inline condense property for the cell
|
|
111
125
|
# @return [Boolean]
|
|
112
126
|
attr_reader :condense
|
|
113
127
|
|
|
114
128
|
# @see condense
|
|
115
|
-
def condense=(v)
|
|
129
|
+
def condense=(v)
|
|
130
|
+
set_run_style :validate_boolean, :condense, v
|
|
131
|
+
end
|
|
116
132
|
|
|
117
133
|
# The inline extend property for the cell
|
|
118
134
|
# @return [Boolean]
|
|
119
135
|
attr_reader :extend
|
|
120
136
|
|
|
121
137
|
# @see extend
|
|
122
|
-
def extend=(v)
|
|
138
|
+
def extend=(v)
|
|
139
|
+
set_run_style :validate_boolean, :extend, v
|
|
140
|
+
end
|
|
123
141
|
|
|
124
142
|
# The inline underline property for the cell.
|
|
125
143
|
# It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting, true
|
|
126
144
|
# @return [Boolean]
|
|
127
145
|
# @return [String]
|
|
128
|
-
# @note true is for backwards
|
|
146
|
+
# @note true is for backwards compatibility and is reassigned to :single
|
|
129
147
|
attr_reader :u
|
|
130
148
|
|
|
131
149
|
# @see u
|
|
@@ -148,7 +166,9 @@ module Axlsx
|
|
|
148
166
|
attr_reader :sz
|
|
149
167
|
|
|
150
168
|
# @see sz
|
|
151
|
-
def sz=(v)
|
|
169
|
+
def sz=(v)
|
|
170
|
+
set_run_style :validate_unsigned_int, :sz, v
|
|
171
|
+
end
|
|
152
172
|
|
|
153
173
|
# The inline vertical alignment property for the cell
|
|
154
174
|
# this must be one of [:baseline, :subscript, :superscript]
|
|
@@ -143,7 +143,10 @@ module Axlsx
|
|
|
143
143
|
private
|
|
144
144
|
|
|
145
145
|
# assigns the owning worksheet for this row
|
|
146
|
-
def worksheet=(v)
|
|
146
|
+
def worksheet=(v)
|
|
147
|
+
DataTypeValidator.validate :row_worksheet, Worksheet, v
|
|
148
|
+
@worksheet = v
|
|
149
|
+
end
|
|
147
150
|
|
|
148
151
|
# Converts values, types, and style options into cells and associates them with this row.
|
|
149
152
|
# A new cell is created for each item in the values array.
|
|
@@ -160,7 +163,7 @@ module Axlsx
|
|
|
160
163
|
types, style, formula_values, escape_formulas, offset = options.delete(:types), options.delete(:style), options.delete(:formula_values), options.delete(:escape_formulas), options.delete(:offset)
|
|
161
164
|
offset.to_i.times { |index| self[index] = Cell.new(self) } if offset
|
|
162
165
|
values.each_with_index do |value, index|
|
|
163
|
-
options[:style] = style.is_a?(Array) ? style[index] : style
|
|
166
|
+
options[:style] = (style.is_a?(Array) ? style[index] : style) || worksheet.column_info[index]&.style
|
|
164
167
|
options[:type] = types.is_a?(Array) ? types[index] : types if types
|
|
165
168
|
options[:escape_formulas] = escape_formulas.is_a?(Array) ? escape_formulas[index] : escape_formulas unless escape_formulas.nil?
|
|
166
169
|
options[:formula_value] = formula_values[index] if formula_values.is_a?(Array)
|
|
@@ -80,7 +80,10 @@ module Axlsx
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# @see active_cell_id
|
|
83
|
-
def active_cell_id=(v)
|
|
83
|
+
def active_cell_id=(v)
|
|
84
|
+
Axlsx.validate_unsigned_int(v)
|
|
85
|
+
@active_cell_id = v
|
|
86
|
+
end
|
|
84
87
|
|
|
85
88
|
# @see pane
|
|
86
89
|
def pane=(v)
|
|
@@ -89,7 +92,10 @@ module Axlsx
|
|
|
89
92
|
end
|
|
90
93
|
|
|
91
94
|
# @see sqref
|
|
92
|
-
def sqref=(v)
|
|
95
|
+
def sqref=(v)
|
|
96
|
+
Axlsx.validate_string(v)
|
|
97
|
+
@sqref = v
|
|
98
|
+
end
|
|
93
99
|
|
|
94
100
|
# Serializes the data validation
|
|
95
101
|
# @param [String] str
|
|
@@ -18,7 +18,7 @@ module Axlsx
|
|
|
18
18
|
:sync_ref
|
|
19
19
|
|
|
20
20
|
# These attributes are all boolean so I'm doing a bit of a hand
|
|
21
|
-
# waving magic show to set up the
|
|
21
|
+
# waving magic show to set up the attribute accessors
|
|
22
22
|
boolean_attr_accessor :sync_horizontal,
|
|
23
23
|
:sync_vertical,
|
|
24
24
|
:transition_evaluation,
|
|
@@ -33,8 +33,8 @@ module Axlsx
|
|
|
33
33
|
def initialize(options = {})
|
|
34
34
|
# defaults
|
|
35
35
|
@color_id = @top_left_cell = @pane = nil
|
|
36
|
-
@right_to_left = @show_formulas = @
|
|
37
|
-
@default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = true
|
|
36
|
+
@right_to_left = @show_formulas = @show_white_space = @tab_selected = @window_protection = false
|
|
37
|
+
@default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = @show_outline_symbols = true
|
|
38
38
|
@zoom_scale = 100
|
|
39
39
|
@zoom_scale_normal = @zoom_scale_page_layout_view = @zoom_scale_sheet_layout_view = @workbook_view_id = 0
|
|
40
40
|
@selections = {}
|
|
@@ -162,7 +162,10 @@ module Axlsx
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
# @see color_id
|
|
165
|
-
def color_id=(v)
|
|
165
|
+
def color_id=(v)
|
|
166
|
+
Axlsx.validate_unsigned_int(v)
|
|
167
|
+
@color_id = v
|
|
168
|
+
end
|
|
166
169
|
|
|
167
170
|
# @see top_left_cell
|
|
168
171
|
def top_left_cell=(v)
|
|
@@ -172,22 +175,40 @@ module Axlsx
|
|
|
172
175
|
end
|
|
173
176
|
|
|
174
177
|
# @see view
|
|
175
|
-
def view=(v)
|
|
178
|
+
def view=(v)
|
|
179
|
+
Axlsx.validate_sheet_view_type(v)
|
|
180
|
+
@view = v
|
|
181
|
+
end
|
|
176
182
|
|
|
177
183
|
# @see workbook_view_id
|
|
178
|
-
def workbook_view_id=(v)
|
|
184
|
+
def workbook_view_id=(v)
|
|
185
|
+
Axlsx.validate_unsigned_int(v)
|
|
186
|
+
@workbook_view_id = v
|
|
187
|
+
end
|
|
179
188
|
|
|
180
189
|
# @see zoom_scale
|
|
181
|
-
def zoom_scale=(v)
|
|
190
|
+
def zoom_scale=(v)
|
|
191
|
+
Axlsx.validate_scale_0_10_400(v)
|
|
192
|
+
@zoom_scale = v
|
|
193
|
+
end
|
|
182
194
|
|
|
183
195
|
# @see zoom_scale_normal
|
|
184
|
-
def zoom_scale_normal=(v)
|
|
196
|
+
def zoom_scale_normal=(v)
|
|
197
|
+
Axlsx.validate_scale_0_10_400(v)
|
|
198
|
+
@zoom_scale_normal = v
|
|
199
|
+
end
|
|
185
200
|
|
|
186
201
|
# @see zoom_scale_page_layout_view
|
|
187
|
-
def zoom_scale_page_layout_view=(v)
|
|
202
|
+
def zoom_scale_page_layout_view=(v)
|
|
203
|
+
Axlsx.validate_scale_0_10_400(v)
|
|
204
|
+
@zoom_scale_page_layout_view = v
|
|
205
|
+
end
|
|
188
206
|
|
|
189
207
|
# @see zoom_scale_sheet_layout_view
|
|
190
|
-
def zoom_scale_sheet_layout_view=(v)
|
|
208
|
+
def zoom_scale_sheet_layout_view=(v)
|
|
209
|
+
Axlsx.validate_scale_0_10_400(v)
|
|
210
|
+
@zoom_scale_sheet_layout_view = v
|
|
211
|
+
end
|
|
191
212
|
|
|
192
213
|
# Serializes the data validation
|
|
193
214
|
# @param [String] str
|
|
@@ -34,14 +34,14 @@ module Axlsx
|
|
|
34
34
|
# explicitly be disabled or all will show.
|
|
35
35
|
def initialize_defaults
|
|
36
36
|
%w(show_first_column show_last_column show_row_stripes show_column_stripes).each do |attr|
|
|
37
|
-
send("#{attr}=", 0)
|
|
37
|
+
send(:"#{attr}=", 0)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# The name of the table style.
|
|
42
42
|
attr_accessor :name
|
|
43
43
|
|
|
44
|
-
#
|
|
44
|
+
# serializes this object to an xml string
|
|
45
45
|
# @param [String] str the string to contact this objects serialization to.
|
|
46
46
|
def to_xml_string(str = +'')
|
|
47
47
|
serialized_tag('tableStyleInfo', str)
|