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