caxlsx 3.3.0 → 4.0.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 +25 -0
- data/README.md +25 -7
- data/Rakefile +7 -6
- data/lib/axlsx/content_type/abstract_content_type.rb +11 -9
- data/lib/axlsx/content_type/content_type.rb +7 -9
- data/lib/axlsx/content_type/default.rb +4 -6
- data/lib/axlsx/content_type/override.rb +3 -5
- data/lib/axlsx/doc_props/app.rb +27 -30
- data/lib/axlsx/doc_props/core.rb +9 -12
- data/lib/axlsx/drawing/area_chart.rb +13 -14
- data/lib/axlsx/drawing/area_series.rb +13 -14
- data/lib/axlsx/drawing/ax_data_source.rb +3 -6
- data/lib/axlsx/drawing/axes.rb +10 -9
- data/lib/axlsx/drawing/axis.rb +27 -30
- data/lib/axlsx/drawing/bar_3D_chart.rb +17 -18
- data/lib/axlsx/drawing/bar_chart.rb +16 -17
- data/lib/axlsx/drawing/bar_series.rb +9 -13
- data/lib/axlsx/drawing/bubble_chart.rb +8 -9
- data/lib/axlsx/drawing/bubble_series.rb +9 -10
- data/lib/axlsx/drawing/cat_axis.rb +14 -17
- data/lib/axlsx/drawing/chart.rb +25 -28
- data/lib/axlsx/drawing/d_lbls.rb +29 -26
- data/lib/axlsx/drawing/drawing.rb +60 -62
- data/lib/axlsx/drawing/graphic_frame.rb +6 -7
- data/lib/axlsx/drawing/hyperlink.rb +12 -13
- data/lib/axlsx/drawing/line_3D_chart.rb +13 -15
- data/lib/axlsx/drawing/line_chart.rb +13 -14
- data/lib/axlsx/drawing/line_series.rb +13 -14
- data/lib/axlsx/drawing/marker.rb +14 -16
- data/lib/axlsx/drawing/num_data.rb +13 -16
- data/lib/axlsx/drawing/num_data_source.rb +11 -13
- data/lib/axlsx/drawing/num_val.rb +9 -10
- data/lib/axlsx/drawing/one_cell_anchor.rb +10 -10
- data/lib/axlsx/drawing/pic.rb +57 -22
- data/lib/axlsx/drawing/picture_locking.rb +6 -7
- data/lib/axlsx/drawing/pie_3D_chart.rb +6 -9
- data/lib/axlsx/drawing/pie_series.rb +9 -12
- data/lib/axlsx/drawing/scaling.rb +9 -10
- data/lib/axlsx/drawing/scatter_chart.rb +9 -10
- data/lib/axlsx/drawing/scatter_series.rb +15 -16
- data/lib/axlsx/drawing/ser_axis.rb +9 -11
- data/lib/axlsx/drawing/series.rb +8 -8
- data/lib/axlsx/drawing/series_title.rb +6 -6
- data/lib/axlsx/drawing/str_data.rb +10 -13
- data/lib/axlsx/drawing/str_val.rb +8 -9
- data/lib/axlsx/drawing/title.rb +23 -27
- data/lib/axlsx/drawing/two_cell_anchor.rb +8 -8
- data/lib/axlsx/drawing/val_axis.rb +5 -6
- data/lib/axlsx/drawing/view_3D.rb +32 -30
- data/lib/axlsx/drawing/vml_drawing.rb +19 -20
- data/lib/axlsx/drawing/vml_shape.rb +25 -26
- data/lib/axlsx/package.rb +81 -79
- data/lib/axlsx/rels/relationship.rb +30 -28
- data/lib/axlsx/rels/relationships.rb +7 -8
- data/lib/axlsx/stylesheet/border.rb +7 -8
- data/lib/axlsx/stylesheet/border_pr.rb +8 -8
- data/lib/axlsx/stylesheet/cell_alignment.rb +14 -20
- data/lib/axlsx/stylesheet/cell_protection.rb +6 -7
- data/lib/axlsx/stylesheet/cell_style.rb +12 -14
- data/lib/axlsx/stylesheet/color.rb +15 -12
- data/lib/axlsx/stylesheet/dxf.rb +7 -9
- data/lib/axlsx/stylesheet/fill.rb +3 -5
- data/lib/axlsx/stylesheet/font.rb +24 -21
- data/lib/axlsx/stylesheet/gradient_fill.rb +9 -9
- data/lib/axlsx/stylesheet/gradient_stop.rb +7 -6
- data/lib/axlsx/stylesheet/num_fmt.rb +9 -14
- data/lib/axlsx/stylesheet/pattern_fill.rb +8 -8
- data/lib/axlsx/stylesheet/styles.rb +104 -98
- data/lib/axlsx/stylesheet/table_style.rb +8 -9
- data/lib/axlsx/stylesheet/table_style_element.rb +7 -8
- data/lib/axlsx/stylesheet/table_styles.rb +8 -10
- data/lib/axlsx/stylesheet/xf.rb +21 -22
- data/lib/axlsx/util/accessors.rb +6 -6
- data/lib/axlsx/util/buffered_zip_output_stream.rb +60 -0
- data/lib/axlsx/util/constants.rb +119 -108
- data/lib/axlsx/util/mime_type_utils.rb +11 -0
- data/lib/axlsx/util/options_parser.rb +4 -3
- data/lib/axlsx/util/serialized_attributes.rb +45 -21
- data/lib/axlsx/util/simple_typed_list.rb +58 -57
- data/lib/axlsx/util/storage.rb +38 -41
- data/lib/axlsx/util/validators.rb +107 -44
- data/lib/axlsx/util/zip_command.rb +10 -12
- data/lib/axlsx/version.rb +3 -2
- data/lib/axlsx/workbook/defined_name.rb +11 -8
- data/lib/axlsx/workbook/defined_names.rb +4 -3
- data/lib/axlsx/workbook/shared_strings_table.rb +10 -11
- data/lib/axlsx/workbook/workbook.rb +121 -114
- data/lib/axlsx/workbook/workbook_view.rb +8 -11
- data/lib/axlsx/workbook/workbook_views.rb +4 -4
- data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +72 -14
- data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +11 -7
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +24 -21
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb +51 -0
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_state.rb +56 -0
- data/lib/axlsx/workbook/worksheet/border_creator.rb +30 -25
- data/lib/axlsx/workbook/worksheet/break.rb +4 -5
- data/lib/axlsx/workbook/worksheet/cell.rb +92 -65
- data/lib/axlsx/workbook/worksheet/cell_serializer.rb +32 -28
- data/lib/axlsx/workbook/worksheet/cfvo.rb +7 -5
- data/lib/axlsx/workbook/worksheet/cfvos.rb +5 -5
- data/lib/axlsx/workbook/worksheet/col.rb +9 -10
- data/lib/axlsx/workbook/worksheet/col_breaks.rb +8 -7
- data/lib/axlsx/workbook/worksheet/color_scale.rb +16 -16
- data/lib/axlsx/workbook/worksheet/cols.rb +9 -7
- data/lib/axlsx/workbook/worksheet/comment.rb +12 -11
- data/lib/axlsx/workbook/worksheet/comments.rb +10 -12
- data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +12 -8
- data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +19 -21
- data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +5 -5
- data/lib/axlsx/workbook/worksheet/data_bar.rb +29 -30
- data/lib/axlsx/workbook/worksheet/data_validation.rb +34 -33
- data/lib/axlsx/workbook/worksheet/data_validations.rb +5 -6
- data/lib/axlsx/workbook/worksheet/date_time_converter.rb +8 -8
- data/lib/axlsx/workbook/worksheet/dimension.rb +9 -6
- data/lib/axlsx/workbook/worksheet/header_footer.rb +4 -3
- data/lib/axlsx/workbook/worksheet/icon_set.rb +24 -8
- data/lib/axlsx/workbook/worksheet/merged_cells.rb +10 -10
- data/lib/axlsx/workbook/worksheet/outline_pr.rb +6 -3
- data/lib/axlsx/workbook/worksheet/page_margins.rb +17 -12
- data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +6 -4
- data/lib/axlsx/workbook/worksheet/page_setup.rb +128 -129
- data/lib/axlsx/workbook/worksheet/pane.rb +27 -26
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +23 -25
- data/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +12 -13
- data/lib/axlsx/workbook/worksheet/pivot_tables.rb +5 -4
- data/lib/axlsx/workbook/worksheet/print_options.rb +3 -2
- data/lib/axlsx/workbook/worksheet/protected_range.rb +6 -5
- data/lib/axlsx/workbook/worksheet/protected_ranges.rb +12 -10
- data/lib/axlsx/workbook/worksheet/rich_text.rb +6 -6
- data/lib/axlsx/workbook/worksheet/rich_text_run.rb +35 -17
- data/lib/axlsx/workbook/worksheet/row.rb +30 -22
- data/lib/axlsx/workbook/worksheet/row_breaks.rb +8 -7
- data/lib/axlsx/workbook/worksheet/selection.rb +16 -16
- data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +10 -7
- data/lib/axlsx/workbook/worksheet/sheet_data.rb +7 -7
- data/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +23 -19
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +11 -7
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +21 -20
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +48 -53
- data/lib/axlsx/workbook/worksheet/table.rb +13 -13
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +6 -5
- data/lib/axlsx/workbook/worksheet/tables.rb +7 -5
- data/lib/axlsx/workbook/worksheet/worksheet.rb +92 -63
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +10 -8
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +11 -4
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +9 -8
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +7 -5
- data/lib/axlsx.rb +75 -47
- data/lib/caxlsx.rb +3 -2
- metadata +50 -44
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Axlsx
|
2
4
|
# Page setup settings for printing a worksheet. All settings are optional.
|
3
5
|
#
|
@@ -5,7 +7,6 @@ module Axlsx
|
|
5
7
|
# @see Worksheet#print_options
|
6
8
|
# @see Worksheet#initialize
|
7
9
|
class PageSetup
|
8
|
-
|
9
10
|
include Axlsx::OptionsParser
|
10
11
|
include Axlsx::SerializedAttributes
|
11
12
|
|
@@ -18,7 +19,7 @@ module Axlsx
|
|
18
19
|
# @option options [Integer] scale Print scaling (percent value, integer ranging from 10 to 400)
|
19
20
|
# @option options [Integer] paper_size - the size of paper to use
|
20
21
|
def initialize(options = {})
|
21
|
-
|
22
|
+
parse_options options
|
22
23
|
end
|
23
24
|
|
24
25
|
serializable_attributes :fit_to_height, :fit_to_width, :orientation, :paper_height, :paper_width, :scale, :paper_size
|
@@ -65,124 +66,123 @@ module Axlsx
|
|
65
66
|
attr_reader :scale
|
66
67
|
|
67
68
|
# The paper size to use in printing
|
68
|
-
#1 = Letter paper (8.5 in. by 11 in.)
|
69
|
-
#2 = Letter small paper (8.5 in. by 11 in.)
|
70
|
-
#3 = Tabloid paper (11 in. by 17 in.)
|
71
|
-
#4 = Ledger paper (17 in. by 11 in.)
|
72
|
-
#5 = Legal paper (8.5 in. by 14 in.)
|
73
|
-
#6 = Statement paper (5.5 in. by 8.5 in.)
|
74
|
-
#7 = Executive paper (7.25 in. by 10.5 in.)
|
75
|
-
#8 = A3 paper (297 mm by 420 mm)
|
76
|
-
#9 = A4 paper (210 mm by 297 mm)
|
77
|
-
#10 = A4 small paper (210 mm by 297 mm)
|
78
|
-
#11 = A5 paper (148 mm by 210 mm)
|
79
|
-
#12 = B4 paper (250 mm by 353 mm)
|
80
|
-
#13 = B5 paper (176 mm by 250 mm)
|
81
|
-
#14 = Folio paper (8.5 in. by 13 in.)
|
82
|
-
#15 = Quarto paper (215 mm by 275 mm)
|
83
|
-
#16 = Standard paper (10 in. by 14 in.)
|
84
|
-
#17 = Standard paper (11 in. by 17 in.)
|
85
|
-
#18 = Note paper (8.5 in. by 11 in.)
|
86
|
-
#19 = #9 envelope (3.875 in. by 8.875 in.)
|
87
|
-
#20 = #10 envelope (4.125 in. by 9.5 in.)
|
88
|
-
#21 = #11 envelope (4.5 in. by 10.375 in.)
|
89
|
-
#22 = #12 envelope (4.75 in. by 11 in.)
|
90
|
-
#23 = #14 envelope (5 in. by 11.5 in.) 24 = C paper (17 in. by 22 in.)
|
91
|
-
#25 = D paper (22 in. by 34 in.)
|
92
|
-
#26 = E paper (34 in. by 44 in.)
|
93
|
-
#27 = DL envelope (110 mm by 220 mm)
|
94
|
-
#28 = C5 envelope (162 mm by 229 mm)
|
95
|
-
#29 = C3 envelope (324 mm by 458 mm)
|
96
|
-
#30 = C4 envelope (229 mm by 324 mm)
|
97
|
-
#31 = C6 envelope (114 mm by 162 mm)
|
98
|
-
#32 = C65 envelope (114 mm by 229 mm)
|
99
|
-
#33 = B4 envelope (250 mm by 353 mm)
|
100
|
-
#34 = B5 envelope (176 mm by 250 mm)
|
101
|
-
#35 = B6 envelope (176 mm by 125 mm)
|
102
|
-
#36 = Italy envelope (110 mm by 230 mm)
|
103
|
-
#37 = Monarch envelope (3.875 in. by 7.5 in.). 38 = 6 3/4 envelope (3.625 in. by 6.5 in.)
|
104
|
-
#39 = US standard fanfold (14.875 in. by 11 in.)
|
105
|
-
#40 = German standard fanfold (8.5 in. by 12 in.)
|
106
|
-
#41 = German legal fanfold (8.5 in. by 13 in.)
|
107
|
-
#42 = ISO B4 (250 mm by 353 mm)
|
108
|
-
#43 = Japanese double postcard (200 mm by 148 mm)
|
109
|
-
#44 = Standard paper (9 in. by 11 in.)
|
110
|
-
#45 = Standard paper (10 in. by 11 in.)
|
111
|
-
#46 = Standard paper (15 in. by 11 in.)
|
112
|
-
#47 = Invite envelope (220 mm by 220 mm)
|
113
|
-
#50 = Letter extra paper (9.275 in. by 12 in.)
|
114
|
-
#51 = Legal extra paper (9.275 in. by 15 in.)
|
115
|
-
#52 = Tabloid extra paper (11.69 in. by 18 in.)
|
116
|
-
#53 = A4 extra paper (236 mm by 322 mm)
|
117
|
-
#54 = Letter transverse paper (8.275 in. by 11 in.)
|
118
|
-
#55 = A4 transverse paper (210 mm by 297 mm)
|
119
|
-
#56 = Letter extra transverse paper (9.275 in. by 12 in.)
|
120
|
-
#57 = SuperA/SuperA/A4 paper (227 mm by 356 mm)
|
121
|
-
#58 = SuperB/SuperB/A3 paper (305 mm by 487 mm)
|
122
|
-
#59 = Letter plus paper (8.5 in. by 12.69 in.)
|
123
|
-
#60 = A4 plus paper (210 mm by 330 mm)
|
124
|
-
#61 = A5 transverse paper (148 mm by 210 mm)
|
125
|
-
#62 = JIS B5 transverse paper (182 mm by 257 mm)
|
126
|
-
#63 = A3 extra paper (322 mm by 445 mm)
|
127
|
-
#64 = A5 extra paper (174 mm by 235 mm)
|
128
|
-
#65 = ISO B5 extra paper (201 mm by 276 mm)
|
129
|
-
#66 = A2 paper (420 mm by 594 mm)
|
130
|
-
#67 = A3 transverse paper (297 mm by 420 mm)
|
131
|
-
#68 = A3 extra transverse paper (322 mm by 445 mm)
|
132
|
-
#69 = Japanese Double Postcard (200 mm x 148 mm)
|
133
|
-
#70 = A6 (105 mm x 148 mm
|
134
|
-
#71 = Japanese Envelope Kaku #2
|
135
|
-
#72 = Japanese Envelope Kaku #3
|
136
|
-
#73 = Japanese Envelope Chou #3
|
137
|
-
#74 = Japanese Envelope Chou #4
|
138
|
-
#75 = Letter Rotated (11in x 8 1/2 11 in)
|
139
|
-
#76 = A3 Rotated (420 mm x 297 mm)
|
140
|
-
#77 = A4 Rotated (297 mm x 210 mm)
|
141
|
-
#78 = A5 Rotated (210 mm x 148 mm)
|
142
|
-
#79 = B4 (JIS) Rotated (364 mm x 257 mm)
|
143
|
-
#80 = B5 (JIS) Rotated (257 mm x 182 mm)
|
144
|
-
#81 = Japanese Postcard Rotated (148 mm x 100 mm)
|
145
|
-
#82 = Double Japanese Postcard Rotated (148 mm x 200 mm)
|
146
|
-
#83 = A6 Rotated (148 mm x 105 mm)
|
147
|
-
#84 = Japanese Envelope Kaku #2 Rotated
|
148
|
-
#85 = Japanese Envelope Kaku #3 Rotated
|
149
|
-
#86 = Japanese Envelope Chou #3 Rotated
|
150
|
-
#87 = Japanese Envelope Chou #4 Rotated
|
151
|
-
#88 = B6 (JIS) (128 mm x 182 mm)
|
152
|
-
#89 = B6 (JIS) Rotated (182 mm x 128 mm)
|
153
|
-
#90 = (12 in x 11 in)
|
154
|
-
#91 = Japanese Envelope You #4
|
155
|
-
#92 = Japanese Envelope You #4 Rotated
|
156
|
-
#93 = PRC 16K (146 mm x 215 mm)
|
157
|
-
#94 = PRC 32K (97 mm x 151 mm)
|
158
|
-
#95 = PRC 32K(Big) (97 mm x 151 mm)
|
159
|
-
#96 = PRC Envelope #1 (102 mm x 165 mm)
|
160
|
-
#97 = PRC Envelope #2 (102 mm x 176 mm)
|
161
|
-
#98 = PRC Envelope #3 (125 mm x 176 mm)
|
162
|
-
#99 = PRC Envelope #4 (110 mm x 208 mm)
|
163
|
-
#100 = PRC Envelope #5 (110 mm x 220 mm)
|
164
|
-
#101 = PRC Envelope #6 (120 mm x 230 mm)
|
165
|
-
#102 = PRC Envelope #7 (160 mm x 230 mm)
|
166
|
-
#103 = PRC Envelope #8 (120 mm x 309 mm)
|
167
|
-
#104 = PRC Envelope #9 (229 mm x 324 mm)
|
168
|
-
#105 = PRC Envelope #10 (324 mm x 458 mm)
|
169
|
-
#106 = PRC 16K Rotated
|
170
|
-
#107 = PRC 32K Rotated
|
171
|
-
#108 = PRC 32K(Big) Rotated
|
172
|
-
#109 = PRC Envelope #1 Rotated (165 mm x 102 mm)
|
173
|
-
#110 = PRC Envelope #2 Rotated (176 mm x 102 mm)
|
174
|
-
#111 = PRC Envelope #3 Rotated (176 mm x 125 mm)
|
175
|
-
#112 = PRC Envelope #4 Rotated (208 mm x 110 mm)
|
176
|
-
#113 = PRC Envelope #5 Rotated (220 mm x 110 mm)
|
177
|
-
#114 = PRC Envelope #6 Rotated (230 mm x 120 mm)
|
178
|
-
#115 = PRC Envelope #7 Rotated (230 mm x 160 mm)
|
179
|
-
#116 = PRC Envelope #8 Rotated (309 mm x 120 mm)
|
180
|
-
#117 = PRC Envelope #9 Rotated (324 mm x 229 mm)
|
181
|
-
#118 = PRC Envelope #10 Rotated (458 mm x 324 mm)
|
69
|
+
# 1 = Letter paper (8.5 in. by 11 in.)
|
70
|
+
# 2 = Letter small paper (8.5 in. by 11 in.)
|
71
|
+
# 3 = Tabloid paper (11 in. by 17 in.)
|
72
|
+
# 4 = Ledger paper (17 in. by 11 in.)
|
73
|
+
# 5 = Legal paper (8.5 in. by 14 in.)
|
74
|
+
# 6 = Statement paper (5.5 in. by 8.5 in.)
|
75
|
+
# 7 = Executive paper (7.25 in. by 10.5 in.)
|
76
|
+
# 8 = A3 paper (297 mm by 420 mm)
|
77
|
+
# 9 = A4 paper (210 mm by 297 mm)
|
78
|
+
# 10 = A4 small paper (210 mm by 297 mm)
|
79
|
+
# 11 = A5 paper (148 mm by 210 mm)
|
80
|
+
# 12 = B4 paper (250 mm by 353 mm)
|
81
|
+
# 13 = B5 paper (176 mm by 250 mm)
|
82
|
+
# 14 = Folio paper (8.5 in. by 13 in.)
|
83
|
+
# 15 = Quarto paper (215 mm by 275 mm)
|
84
|
+
# 16 = Standard paper (10 in. by 14 in.)
|
85
|
+
# 17 = Standard paper (11 in. by 17 in.)
|
86
|
+
# 18 = Note paper (8.5 in. by 11 in.)
|
87
|
+
# 19 = #9 envelope (3.875 in. by 8.875 in.)
|
88
|
+
# 20 = #10 envelope (4.125 in. by 9.5 in.)
|
89
|
+
# 21 = #11 envelope (4.5 in. by 10.375 in.)
|
90
|
+
# 22 = #12 envelope (4.75 in. by 11 in.)
|
91
|
+
# 23 = #14 envelope (5 in. by 11.5 in.) 24 = C paper (17 in. by 22 in.)
|
92
|
+
# 25 = D paper (22 in. by 34 in.)
|
93
|
+
# 26 = E paper (34 in. by 44 in.)
|
94
|
+
# 27 = DL envelope (110 mm by 220 mm)
|
95
|
+
# 28 = C5 envelope (162 mm by 229 mm)
|
96
|
+
# 29 = C3 envelope (324 mm by 458 mm)
|
97
|
+
# 30 = C4 envelope (229 mm by 324 mm)
|
98
|
+
# 31 = C6 envelope (114 mm by 162 mm)
|
99
|
+
# 32 = C65 envelope (114 mm by 229 mm)
|
100
|
+
# 33 = B4 envelope (250 mm by 353 mm)
|
101
|
+
# 34 = B5 envelope (176 mm by 250 mm)
|
102
|
+
# 35 = B6 envelope (176 mm by 125 mm)
|
103
|
+
# 36 = Italy envelope (110 mm by 230 mm)
|
104
|
+
# 37 = Monarch envelope (3.875 in. by 7.5 in.). 38 = 6 3/4 envelope (3.625 in. by 6.5 in.)
|
105
|
+
# 39 = US standard fanfold (14.875 in. by 11 in.)
|
106
|
+
# 40 = German standard fanfold (8.5 in. by 12 in.)
|
107
|
+
# 41 = German legal fanfold (8.5 in. by 13 in.)
|
108
|
+
# 42 = ISO B4 (250 mm by 353 mm)
|
109
|
+
# 43 = Japanese double postcard (200 mm by 148 mm)
|
110
|
+
# 44 = Standard paper (9 in. by 11 in.)
|
111
|
+
# 45 = Standard paper (10 in. by 11 in.)
|
112
|
+
# 46 = Standard paper (15 in. by 11 in.)
|
113
|
+
# 47 = Invite envelope (220 mm by 220 mm)
|
114
|
+
# 50 = Letter extra paper (9.275 in. by 12 in.)
|
115
|
+
# 51 = Legal extra paper (9.275 in. by 15 in.)
|
116
|
+
# 52 = Tabloid extra paper (11.69 in. by 18 in.)
|
117
|
+
# 53 = A4 extra paper (236 mm by 322 mm)
|
118
|
+
# 54 = Letter transverse paper (8.275 in. by 11 in.)
|
119
|
+
# 55 = A4 transverse paper (210 mm by 297 mm)
|
120
|
+
# 56 = Letter extra transverse paper (9.275 in. by 12 in.)
|
121
|
+
# 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm)
|
122
|
+
# 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm)
|
123
|
+
# 59 = Letter plus paper (8.5 in. by 12.69 in.)
|
124
|
+
# 60 = A4 plus paper (210 mm by 330 mm)
|
125
|
+
# 61 = A5 transverse paper (148 mm by 210 mm)
|
126
|
+
# 62 = JIS B5 transverse paper (182 mm by 257 mm)
|
127
|
+
# 63 = A3 extra paper (322 mm by 445 mm)
|
128
|
+
# 64 = A5 extra paper (174 mm by 235 mm)
|
129
|
+
# 65 = ISO B5 extra paper (201 mm by 276 mm)
|
130
|
+
# 66 = A2 paper (420 mm by 594 mm)
|
131
|
+
# 67 = A3 transverse paper (297 mm by 420 mm)
|
132
|
+
# 68 = A3 extra transverse paper (322 mm by 445 mm)
|
133
|
+
# 69 = Japanese Double Postcard (200 mm x 148 mm)
|
134
|
+
# 70 = A6 (105 mm x 148 mm
|
135
|
+
# 71 = Japanese Envelope Kaku #2
|
136
|
+
# 72 = Japanese Envelope Kaku #3
|
137
|
+
# 73 = Japanese Envelope Chou #3
|
138
|
+
# 74 = Japanese Envelope Chou #4
|
139
|
+
# 75 = Letter Rotated (11in x 8 1/2 11 in)
|
140
|
+
# 76 = A3 Rotated (420 mm x 297 mm)
|
141
|
+
# 77 = A4 Rotated (297 mm x 210 mm)
|
142
|
+
# 78 = A5 Rotated (210 mm x 148 mm)
|
143
|
+
# 79 = B4 (JIS) Rotated (364 mm x 257 mm)
|
144
|
+
# 80 = B5 (JIS) Rotated (257 mm x 182 mm)
|
145
|
+
# 81 = Japanese Postcard Rotated (148 mm x 100 mm)
|
146
|
+
# 82 = Double Japanese Postcard Rotated (148 mm x 200 mm)
|
147
|
+
# 83 = A6 Rotated (148 mm x 105 mm)
|
148
|
+
# 84 = Japanese Envelope Kaku #2 Rotated
|
149
|
+
# 85 = Japanese Envelope Kaku #3 Rotated
|
150
|
+
# 86 = Japanese Envelope Chou #3 Rotated
|
151
|
+
# 87 = Japanese Envelope Chou #4 Rotated
|
152
|
+
# 88 = B6 (JIS) (128 mm x 182 mm)
|
153
|
+
# 89 = B6 (JIS) Rotated (182 mm x 128 mm)
|
154
|
+
# 90 = (12 in x 11 in)
|
155
|
+
# 91 = Japanese Envelope You #4
|
156
|
+
# 92 = Japanese Envelope You #4 Rotated
|
157
|
+
# 93 = PRC 16K (146 mm x 215 mm)
|
158
|
+
# 94 = PRC 32K (97 mm x 151 mm)
|
159
|
+
# 95 = PRC 32K(Big) (97 mm x 151 mm)
|
160
|
+
# 96 = PRC Envelope #1 (102 mm x 165 mm)
|
161
|
+
# 97 = PRC Envelope #2 (102 mm x 176 mm)
|
162
|
+
# 98 = PRC Envelope #3 (125 mm x 176 mm)
|
163
|
+
# 99 = PRC Envelope #4 (110 mm x 208 mm)
|
164
|
+
# 100 = PRC Envelope #5 (110 mm x 220 mm)
|
165
|
+
# 101 = PRC Envelope #6 (120 mm x 230 mm)
|
166
|
+
# 102 = PRC Envelope #7 (160 mm x 230 mm)
|
167
|
+
# 103 = PRC Envelope #8 (120 mm x 309 mm)
|
168
|
+
# 104 = PRC Envelope #9 (229 mm x 324 mm)
|
169
|
+
# 105 = PRC Envelope #10 (324 mm x 458 mm)
|
170
|
+
# 106 = PRC 16K Rotated
|
171
|
+
# 107 = PRC 32K Rotated
|
172
|
+
# 108 = PRC 32K(Big) Rotated
|
173
|
+
# 109 = PRC Envelope #1 Rotated (165 mm x 102 mm)
|
174
|
+
# 110 = PRC Envelope #2 Rotated (176 mm x 102 mm)
|
175
|
+
# 111 = PRC Envelope #3 Rotated (176 mm x 125 mm)
|
176
|
+
# 112 = PRC Envelope #4 Rotated (208 mm x 110 mm)
|
177
|
+
# 113 = PRC Envelope #5 Rotated (220 mm x 110 mm)
|
178
|
+
# 114 = PRC Envelope #6 Rotated (230 mm x 120 mm)
|
179
|
+
# 115 = PRC Envelope #7 Rotated (230 mm x 160 mm)
|
180
|
+
# 116 = PRC Envelope #8 Rotated (309 mm x 120 mm)
|
181
|
+
# 117 = PRC Envelope #9 Rotated (324 mm x 229 mm)
|
182
|
+
# 118 = PRC Envelope #10 Rotated (458 mm x 324 mm)
|
182
183
|
# @return [Integer]
|
183
184
|
attr_reader :paper_size
|
184
185
|
|
185
|
-
|
186
186
|
# Sets the paper size for printing.
|
187
187
|
# @see PageSetup#paper_size
|
188
188
|
# @return integer
|
@@ -191,49 +191,48 @@ module Axlsx
|
|
191
191
|
@paper_size = size
|
192
192
|
end
|
193
193
|
|
194
|
-
|
194
|
+
# Set some or all page settings at once.
|
195
195
|
# @param [Hash] options The page settings to set (possible keys are :fit_to_height, :fit_to_width, :orientation, :paper_height, :paper_width, and :scale).
|
196
196
|
def set(options)
|
197
197
|
parse_options options
|
198
198
|
end
|
199
199
|
|
200
200
|
# @see fit_to_height
|
201
|
-
def fit_to_height=(v); Axlsx
|
201
|
+
def fit_to_height=(v); Axlsx.validate_unsigned_int(v); @fit_to_height = v; end
|
202
202
|
# @see fit_to_width
|
203
|
-
def fit_to_width=(v); Axlsx
|
203
|
+
def fit_to_width=(v); Axlsx.validate_unsigned_int(v); @fit_to_width = v; end
|
204
204
|
# @see orientation
|
205
|
-
def orientation=(v); Axlsx
|
205
|
+
def orientation=(v); Axlsx.validate_page_orientation(v); @orientation = v; end
|
206
206
|
# @see paper_height
|
207
|
-
def paper_height=(v); Axlsx
|
207
|
+
def paper_height=(v); Axlsx.validate_number_with_unit(v); @paper_height = v; end
|
208
208
|
# @see paper_width
|
209
|
-
def paper_width=(v); Axlsx
|
209
|
+
def paper_width=(v); Axlsx.validate_number_with_unit(v); @paper_width = v; end
|
210
210
|
# @see scale
|
211
|
-
def scale=(v); Axlsx
|
211
|
+
def scale=(v); Axlsx.validate_scale_10_400(v); @scale = v; end
|
212
212
|
|
213
213
|
# convenience method to achieve sanity when setting fit_to_width and fit_to_height
|
214
214
|
# as they both default to 1 if only their counterpart is specified.
|
215
215
|
# @note This method will overwrite any value you explicitly set via the fit_to_height or fit_to_width methods.
|
216
216
|
# @option options [Integer] width The number of pages to fit this worksheet on horizontally. Default 999
|
217
217
|
# @option options [Integer] height The number of pages to fit this worksheet on vertically. Default 999
|
218
|
-
def fit_to(options={})
|
218
|
+
def fit_to(options = {})
|
219
219
|
self.fit_to_width = options[:width] || 999
|
220
220
|
self.fit_to_height = options[:height] || 999
|
221
221
|
[@fit_to_width, @fit_to_height]
|
222
222
|
end
|
223
223
|
|
224
|
-
|
225
224
|
# helper method for worksheet to determine if the page setup is configured for fit to page printing
|
226
225
|
# We treat any page set up that has a value set for fit_to_width or fit_to_height value as fit_to_page.
|
227
226
|
# @return [Boolean]
|
228
227
|
def fit_to_page?
|
229
|
-
# is there some better
|
230
|
-
(fit_to_width
|
228
|
+
# is there some better way to express this?
|
229
|
+
(!fit_to_width.nil? || !fit_to_height.nil?)
|
231
230
|
end
|
232
231
|
|
233
232
|
# Serializes the page settings element.
|
234
233
|
# @param [String] str
|
235
234
|
# @return [String]
|
236
|
-
def to_xml_string(str = '')
|
235
|
+
def to_xml_string(str = +'')
|
237
236
|
serialized_tag('pageSetup', str)
|
238
237
|
end
|
239
238
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Axlsx
|
2
4
|
# Pane options for a worksheet.
|
3
5
|
#
|
4
6
|
# @note The recommended way to manage the pane options is via SheetView#pane
|
5
7
|
# @see SheetView#pane
|
6
8
|
class Pane
|
7
|
-
|
8
9
|
include Axlsx::OptionsParser
|
9
10
|
include Axlsx::SerializedAttributes
|
10
11
|
# Creates a new {Pane} object
|
@@ -13,8 +14,8 @@ module Axlsx
|
|
13
14
|
# @option options [Cell, String] top_left_cell Top Left Visible Cell
|
14
15
|
# @option options [Integer] x_split Horizontal Split Position
|
15
16
|
# @option options [Integer] y_split Vertical Split Position
|
16
|
-
def initialize(options={})
|
17
|
-
#defaults
|
17
|
+
def initialize(options = {})
|
18
|
+
# defaults
|
18
19
|
@active_pane = @state = @top_left_cell = nil
|
19
20
|
@x_split = @y_split = 0
|
20
21
|
parse_options options
|
@@ -24,16 +25,16 @@ module Axlsx
|
|
24
25
|
|
25
26
|
# Active Pane
|
26
27
|
# The pane that is active.
|
27
|
-
# Options are
|
28
|
+
# Options are
|
28
29
|
# * bottom_left: Bottom left pane, when both vertical and horizontal
|
29
30
|
# splits are applied. This value is also used when only
|
30
|
-
# a horizontal split has been applied, dividing the pane
|
31
|
-
# into upper and lower regions. In that case, this value
|
31
|
+
# a horizontal split has been applied, dividing the pane
|
32
|
+
# into upper and lower regions. In that case, this value
|
32
33
|
# specifies the bottom pane.
|
33
34
|
# * bottom_right: Bottom right pane, when both vertical and horizontal
|
34
35
|
# splits are applied.
|
35
36
|
# * top_left: Top left pane, when both vertical and horizontal splits
|
36
|
-
# are applied. This value is also used when only a horizontal
|
37
|
+
# are applied. This value is also used when only a horizontal
|
37
38
|
# split has been applied, dividing the pane into upper and lower
|
38
39
|
# regions. In that case, this value specifies the top pane.
|
39
40
|
# This value is also used when only a vertical split has
|
@@ -41,22 +42,21 @@ module Axlsx
|
|
41
42
|
# regions. In that case, this value specifies the left pane
|
42
43
|
# * top_right: Top right pane, when both vertical and horizontal
|
43
44
|
# splits are applied. This value is also used when only
|
44
|
-
# a vertical split has been applied, dividing the pane
|
45
|
-
# into right and left regions. In that case, this value
|
45
|
+
# a vertical split has been applied, dividing the pane
|
46
|
+
# into right and left regions. In that case, this value
|
46
47
|
# specifies the right pane.
|
47
48
|
# @see type
|
48
49
|
# @return [Symbol]
|
49
50
|
# default nil
|
50
51
|
attr_reader :active_pane
|
51
52
|
|
52
|
-
|
53
53
|
# Split State
|
54
|
-
# Indicates whether the pane has horizontal / vertical
|
54
|
+
# Indicates whether the pane has horizontal / vertical
|
55
55
|
# splits, and whether those splits are frozen.
|
56
|
-
# Options are
|
56
|
+
# Options are
|
57
57
|
# * frozen: Panes are frozen, but were not split being frozen. In
|
58
58
|
# this state, when the panes are unfrozen again, a single
|
59
|
-
# pane results, with no split. In this state, the split
|
59
|
+
# pane results, with no split. In this state, the split
|
60
60
|
# bars are not adjustable.
|
61
61
|
# * frozen_split: Panes are frozen and were split before being frozen. In
|
62
62
|
# this state, when the panes are unfrozen again, the split
|
@@ -69,7 +69,7 @@ module Axlsx
|
|
69
69
|
attr_reader :state
|
70
70
|
|
71
71
|
# Top Left Visible Cell
|
72
|
-
# Location of the top left visible cell in the bottom
|
72
|
+
# Location of the top left visible cell in the bottom
|
73
73
|
# right pane (when in Left-To-Right mode).
|
74
74
|
# @see type
|
75
75
|
# @return [String]
|
@@ -78,7 +78,7 @@ module Axlsx
|
|
78
78
|
|
79
79
|
# Horizontal Split Position
|
80
80
|
# Horizontal position of the split, in 1/20th of a point; 0 (zero)
|
81
|
-
# if none. If the pane is frozen, this value indicates the number
|
81
|
+
# if none. If the pane is frozen, this value indicates the number
|
82
82
|
# of columns visible in the top pane.
|
83
83
|
# @see type
|
84
84
|
# @return [Integer]
|
@@ -86,7 +86,7 @@ module Axlsx
|
|
86
86
|
attr_reader :x_split
|
87
87
|
|
88
88
|
# Vertical Split Position
|
89
|
-
# Vertical position of the split, in 1/20th of a point; 0 (zero)
|
89
|
+
# Vertical position of the split, in 1/20th of a point; 0 (zero)
|
90
90
|
# if none. If the pane is frozen, this value indicates the number
|
91
91
|
# of rows visible in the left pane.
|
92
92
|
# @see type
|
@@ -96,43 +96,44 @@ module Axlsx
|
|
96
96
|
|
97
97
|
# @see active_pane
|
98
98
|
def active_pane=(v)
|
99
|
-
Axlsx
|
100
|
-
@active_pane = Axlsx
|
99
|
+
Axlsx.validate_pane_type(v)
|
100
|
+
@active_pane = Axlsx.camel(v.to_s, false)
|
101
101
|
end
|
102
102
|
|
103
103
|
# @see state
|
104
104
|
def state=(v)
|
105
|
-
Axlsx
|
106
|
-
@state = Axlsx
|
105
|
+
Axlsx.validate_split_state_type(v)
|
106
|
+
@state = Axlsx.camel(v.to_s, false)
|
107
107
|
end
|
108
108
|
|
109
109
|
# @see top_left_cell
|
110
110
|
def top_left_cell=(v)
|
111
|
-
cell = (v.
|
112
|
-
Axlsx
|
111
|
+
cell = (v.instance_of?(Axlsx::Cell) ? v.r_abs : v)
|
112
|
+
Axlsx.validate_string(cell)
|
113
113
|
@top_left_cell = cell
|
114
114
|
end
|
115
115
|
|
116
116
|
# @see x_split
|
117
|
-
def x_split=(v); Axlsx
|
117
|
+
def x_split=(v); Axlsx.validate_unsigned_int(v); @x_split = v end
|
118
118
|
|
119
119
|
# @see y_split
|
120
|
-
def y_split=(v); Axlsx
|
120
|
+
def y_split=(v); Axlsx.validate_unsigned_int(v); @y_split = v end
|
121
121
|
|
122
122
|
# Serializes the data validation
|
123
123
|
# @param [String] str
|
124
124
|
# @return [String]
|
125
|
-
def to_xml_string(str = '')
|
125
|
+
def to_xml_string(str = +'')
|
126
126
|
finalize
|
127
127
|
serialized_tag 'pane', str
|
128
128
|
end
|
129
|
+
|
129
130
|
private
|
130
131
|
|
131
132
|
def finalize
|
132
133
|
if @state == 'frozen' && @top_left_cell.nil?
|
133
134
|
row = @y_split || 0
|
134
135
|
column = @x_split || 0
|
135
|
-
@top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row+1}"
|
136
|
+
@top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row + 1}"
|
136
137
|
end
|
137
138
|
end
|
138
139
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Axlsx
|
3
4
|
# Table
|
4
5
|
# @note Worksheet#add_pivot_table is the recommended way to create tables for your worksheets.
|
5
6
|
# @see README for examples
|
6
7
|
class PivotTable
|
7
|
-
|
8
8
|
include Axlsx::OptionsParser
|
9
9
|
|
10
10
|
# Creates a new PivotTable object
|
@@ -13,12 +13,12 @@ module Axlsx
|
|
13
13
|
# @param [Worksheet] sheet The sheet containing the table data.
|
14
14
|
# @option options [Cell, String] name
|
15
15
|
# @option options [TableStyle] style
|
16
|
-
def initialize(ref, range, sheet, options={})
|
16
|
+
def initialize(ref, range, sheet, options = {})
|
17
17
|
@ref = ref
|
18
18
|
self.range = range
|
19
19
|
@sheet = sheet
|
20
20
|
@sheet.workbook.pivot_tables << self
|
21
|
-
@name = "PivotTable#{index+1}"
|
21
|
+
@name = "PivotTable#{index + 1}"
|
22
22
|
@data_sheet = nil
|
23
23
|
@rows = []
|
24
24
|
@columns = []
|
@@ -92,7 +92,6 @@ module Axlsx
|
|
92
92
|
# @return [Array]
|
93
93
|
attr_reader :rows
|
94
94
|
|
95
|
-
|
96
95
|
# (see #rows)
|
97
96
|
def rows=(v)
|
98
97
|
DataTypeValidator.validate "#{self.class}.rows", [Array], v
|
@@ -125,7 +124,7 @@ module Axlsx
|
|
125
124
|
@data = []
|
126
125
|
v.each do |data_field|
|
127
126
|
if data_field.is_a? String
|
128
|
-
data_field = {:
|
127
|
+
data_field = { ref: data_field }
|
129
128
|
end
|
130
129
|
data_field.each do |key, value|
|
131
130
|
if key == :num_fmt
|
@@ -136,7 +135,6 @@ module Axlsx
|
|
136
135
|
end
|
137
136
|
@data << data_field
|
138
137
|
end
|
139
|
-
@data
|
140
138
|
end
|
141
139
|
|
142
140
|
# The pages
|
@@ -161,13 +159,13 @@ module Axlsx
|
|
161
159
|
# The part name for this table
|
162
160
|
# @return [String]
|
163
161
|
def pn
|
164
|
-
|
162
|
+
format(PIVOT_TABLE_PN, index + 1)
|
165
163
|
end
|
166
164
|
|
167
165
|
# The relationship part name of this pivot table
|
168
166
|
# @return [String]
|
169
167
|
def rels_pn
|
170
|
-
|
168
|
+
format(PIVOT_TABLE_RELS_PN, index + 1)
|
171
169
|
end
|
172
170
|
|
173
171
|
# The cache_definition for this pivot table
|
@@ -187,13 +185,13 @@ module Axlsx
|
|
187
185
|
# Serializes the object
|
188
186
|
# @param [String] str
|
189
187
|
# @return [String]
|
190
|
-
def to_xml_string(str = '')
|
188
|
+
def to_xml_string(str = +'')
|
191
189
|
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
192
190
|
|
193
|
-
str <<
|
191
|
+
str << '<pivotTableDefinition xmlns="' << XML_NS << '" name="' << name << '" cacheId="' << cache_definition.cache_id.to_s << '"' << (data.size <= 1 ? ' dataOnRows="1"' : '') << ' 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">'
|
194
192
|
|
195
|
-
str <<
|
196
|
-
str <<
|
193
|
+
str << '<location firstDataCol="1" firstDataRow="1" firstHeaderRow="1" ref="' << ref << '"/>'
|
194
|
+
str << '<pivotFields count="' << header_cells_count.to_s << '">'
|
197
195
|
|
198
196
|
header_cell_values.each do |cell_value|
|
199
197
|
subtotal = !no_subtotals_on_headers.include?(cell_value)
|
@@ -206,13 +204,13 @@ module Axlsx
|
|
206
204
|
str << '<rowFields count="1"><field x="-2"/></rowFields>'
|
207
205
|
str << '<rowItems count="2"><i><x/></i> <i i="1"><x v="1"/></i></rowItems>'
|
208
206
|
else
|
209
|
-
str <<
|
207
|
+
str << '<rowFields count="' << rows.size.to_s << '">'
|
210
208
|
rows.each do |row_value|
|
211
|
-
str <<
|
209
|
+
str << '<field x="' << header_index_of(row_value).to_s << '"/>'
|
212
210
|
end
|
213
211
|
str << '</rowFields>'
|
214
|
-
str <<
|
215
|
-
rows.size.times do
|
212
|
+
str << '<rowItems count="' << rows.size.to_s << '">'
|
213
|
+
rows.size.times do
|
216
214
|
str << '<i/>'
|
217
215
|
end
|
218
216
|
str << '</rowItems>'
|
@@ -222,7 +220,7 @@ module Axlsx
|
|
222
220
|
str << '<colFields count="1"><field x="-2"/></colFields>'
|
223
221
|
str << "<colItems count=\"#{data.size}\">"
|
224
222
|
str << '<i><x/></i>'
|
225
|
-
data
|
223
|
+
(data.size - 1).times do |i|
|
226
224
|
str << "<i i=\"#{i + 1}\"><x v=\"#{i + 1}\"/></i>"
|
227
225
|
end
|
228
226
|
str << '</colItems>'
|
@@ -230,16 +228,16 @@ module Axlsx
|
|
230
228
|
str << '<colItems count="1"><i/></colItems>'
|
231
229
|
end
|
232
230
|
else
|
233
|
-
str <<
|
231
|
+
str << '<colFields count="' << columns.size.to_s << '">'
|
234
232
|
columns.each do |column_value|
|
235
|
-
str <<
|
233
|
+
str << '<field x="' << header_index_of(column_value).to_s << '"/>'
|
236
234
|
end
|
237
235
|
str << '</colFields>'
|
238
236
|
end
|
239
237
|
unless pages.empty?
|
240
|
-
str <<
|
238
|
+
str << '<pageFields count="' << pages.size.to_s << '">'
|
241
239
|
pages.each do |page_value|
|
242
|
-
str <<
|
240
|
+
str << '<pageField fld="' << header_index_of(page_value).to_s << '"/>'
|
243
241
|
end
|
244
242
|
str << '</pageFields>'
|
245
243
|
end
|
@@ -247,7 +245,7 @@ module Axlsx
|
|
247
245
|
str << "<dataFields count=\"#{data.size}\">"
|
248
246
|
data.each do |datum_value|
|
249
247
|
# The correct name prefix in ["Sum","Average", etc...]
|
250
|
-
str << "<dataField name='#{
|
248
|
+
str << "<dataField name='#{datum_value[:subtotal] || ''} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
|
251
249
|
str << " numFmtId='#{datum_value[:num_fmt]}'" if datum_value[:num_fmt]
|
252
250
|
str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
|
253
251
|
str << "/>"
|
@@ -257,7 +255,7 @@ module Axlsx
|
|
257
255
|
# custom pivot table style
|
258
256
|
unless style_info.empty?
|
259
257
|
str << '<pivotTableStyleInfo'
|
260
|
-
style_info.each do |k,v|
|
258
|
+
style_info.each do |k, v|
|
261
259
|
str << ' ' << k.to_s << '="' << v.to_s << '"'
|
262
260
|
end
|
263
261
|
str << ' />'
|
@@ -268,7 +266,7 @@ module Axlsx
|
|
268
266
|
# References for header cells
|
269
267
|
# @return [Array]
|
270
268
|
def header_cell_refs
|
271
|
-
Axlsx
|
269
|
+
Axlsx.range_to_a(header_range).first
|
272
270
|
end
|
273
271
|
|
274
272
|
# The header cells for the pivot table
|