axlsx 1.1.4 → 1.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.
- data/.yardopts +5 -2
- data/CHANGELOG.md +39 -0
- data/README.md +108 -31
- data/Rakefile +11 -3
- data/examples/basic_charts.rb +54 -0
- data/examples/chart_colors.rb +17 -2
- data/examples/data_validation.rb +50 -0
- data/examples/example.rb +130 -47
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/extractive.pdf +0 -0
- data/examples/extractive.rb +3 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/scraping_html.rb +91 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/sheet_protection.rb +10 -0
- data/examples/sheet_view.rb +34 -0
- data/examples/two_cell_anchor_image.rb +11 -0
- data/lib/axlsx/content_type/content_type.rb +2 -0
- data/lib/axlsx/content_type/default.rb +30 -15
- data/lib/axlsx/content_type/override.rb +29 -14
- data/lib/axlsx/doc_props/app.rb +161 -104
- data/lib/axlsx/doc_props/core.rb +9 -5
- data/lib/axlsx/drawing/ax_data_source.rb +7 -6
- data/lib/axlsx/drawing/axis.rb +82 -36
- data/lib/axlsx/drawing/bar_3D_chart.rb +49 -45
- data/lib/axlsx/drawing/bar_series.rb +2 -1
- data/lib/axlsx/drawing/cat_axis.rb +43 -39
- data/lib/axlsx/drawing/chart.rb +65 -54
- data/lib/axlsx/drawing/d_lbls.rb +100 -0
- data/lib/axlsx/drawing/drawing.rb +20 -8
- data/lib/axlsx/drawing/graphic_frame.rb +2 -1
- data/lib/axlsx/drawing/line_3D_chart.rb +3 -10
- data/lib/axlsx/drawing/num_data.rb +2 -2
- data/lib/axlsx/drawing/num_data_source.rb +4 -1
- data/lib/axlsx/drawing/pic.rb +44 -4
- data/lib/axlsx/drawing/pie_3D_chart.rb +10 -7
- data/lib/axlsx/drawing/scatter_chart.rb +2 -8
- data/lib/axlsx/drawing/title.rb +21 -9
- data/lib/axlsx/drawing/two_cell_anchor.rb +46 -9
- data/lib/axlsx/drawing/view_3D.rb +41 -31
- data/lib/axlsx/drawing/vml_drawing.rb +42 -0
- data/lib/axlsx/drawing/vml_shape.rb +125 -0
- data/lib/axlsx/package.rb +44 -16
- data/lib/axlsx/rels/relationship.rb +3 -3
- data/lib/axlsx/rels/relationships.rb +1 -11
- data/lib/axlsx/stylesheet/gradient_fill.rb +1 -1
- data/lib/axlsx/stylesheet/styles.rb +1 -1
- data/lib/axlsx/stylesheet/table_style.rb +3 -3
- data/lib/axlsx/util/constants.rb +28 -0
- data/lib/axlsx/util/simple_typed_list.rb +15 -21
- data/lib/axlsx/util/validators.rb +80 -7
- data/lib/axlsx/version.rb +2 -7
- data/lib/axlsx/workbook/defined_name.rb +174 -0
- data/lib/axlsx/workbook/defined_names.rb +21 -0
- data/lib/axlsx/workbook/workbook.rb +65 -13
- data/lib/axlsx/workbook/worksheet/auto_filter.rb +34 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +35 -7
- data/lib/axlsx/workbook/worksheet/col.rb +15 -0
- data/lib/axlsx/workbook/worksheet/cols.rb +20 -0
- data/lib/axlsx/workbook/worksheet/comment.rb +101 -0
- data/lib/axlsx/workbook/worksheet/comments.rb +85 -0
- data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +25 -0
- data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
- data/lib/axlsx/workbook/worksheet/data_validation.rb +245 -0
- data/lib/axlsx/workbook/worksheet/data_validations.rb +28 -0
- data/lib/axlsx/workbook/worksheet/dimension.rb +65 -0
- data/lib/axlsx/workbook/worksheet/merged_cells.rb +35 -0
- data/lib/axlsx/workbook/worksheet/page_setup.rb +113 -0
- data/lib/axlsx/workbook/worksheet/pane.rb +144 -0
- data/lib/axlsx/workbook/worksheet/print_options.rb +63 -0
- data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
- data/lib/axlsx/workbook/worksheet/protected_ranges.rb +34 -0
- data/lib/axlsx/workbook/worksheet/row.rb +36 -20
- data/lib/axlsx/workbook/worksheet/selection.rb +111 -0
- data/lib/axlsx/workbook/worksheet/sheet_data.rb +25 -0
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +24 -0
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +224 -0
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +379 -0
- data/lib/axlsx/workbook/worksheet/table.rb +2 -2
- data/lib/axlsx/workbook/worksheet/tables.rb +31 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +377 -255
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +57 -0
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +64 -0
- data/lib/axlsx.rb +30 -15
- data/test/content_type/tc_content_type.rb +1 -6
- data/test/doc_props/tc_app.rb +31 -1
- data/test/doc_props/tc_core.rb +3 -1
- data/test/drawing/tc_axis.rb +38 -3
- data/test/drawing/tc_bar_3D_chart.rb +12 -12
- data/test/drawing/tc_bar_series.rb +1 -2
- data/test/drawing/tc_cat_axis.rb +3 -3
- data/test/drawing/tc_chart.rb +29 -9
- data/test/drawing/tc_d_lbls.rb +47 -0
- data/test/drawing/tc_drawing.rb +11 -5
- data/test/drawing/tc_hyperlink.rb +4 -5
- data/test/drawing/tc_line_series.rb +7 -3
- data/test/drawing/tc_num_data.rb +5 -1
- data/test/drawing/tc_pic.rb +22 -2
- data/test/drawing/tc_pie_3D_chart.rb +4 -8
- data/test/drawing/tc_pie_series.rb +7 -2
- data/test/drawing/tc_scatter_chart.rb +6 -1
- data/test/drawing/tc_scatter_series.rb +1 -1
- data/test/drawing/tc_series.rb +1 -1
- data/test/drawing/tc_title.rb +16 -0
- data/test/drawing/tc_two_cell_anchor.rb +1 -2
- data/test/drawing/tc_view_3D.rb +18 -18
- data/test/drawing/tc_vml_drawing.rb +25 -0
- data/test/drawing/tc_vml_shape.rb +100 -0
- data/test/rels/tc_relationship.rb +1 -0
- data/test/stylesheet/tc_gradient_fill.rb +8 -0
- data/test/stylesheet/tc_pattern_fill.rb +7 -1
- data/test/stylesheet/tc_styles.rb +3 -4
- data/test/stylesheet/tc_table_style.rb +8 -0
- data/test/stylesheet/tc_table_style_element.rb +10 -1
- data/test/tc_helper.rb +1 -0
- data/test/tc_package.rb +93 -17
- data/test/util/tc_simple_typed_list.rb +13 -0
- data/test/util/tc_validators.rb +95 -9
- data/test/workbook/tc_defined_name.rb +41 -0
- data/test/workbook/tc_workbook.rb +5 -3
- data/test/workbook/worksheet/table/tc_table.rb +3 -11
- data/test/workbook/worksheet/tc_cell.rb +30 -6
- data/test/workbook/worksheet/tc_col.rb +9 -0
- data/test/workbook/worksheet/tc_comment.rb +57 -0
- data/test/workbook/worksheet/tc_comments.rb +57 -0
- data/test/workbook/worksheet/tc_conditional_formatting.rb +44 -0
- data/test/workbook/worksheet/tc_data_bar.rb +1 -1
- data/test/workbook/worksheet/tc_data_validation.rb +265 -0
- data/test/workbook/worksheet/tc_page_setup.rb +138 -0
- data/test/workbook/worksheet/tc_pane.rb +94 -0
- data/test/workbook/worksheet/tc_print_options.rb +72 -0
- data/test/workbook/worksheet/tc_protected_range.rb +17 -0
- data/test/workbook/worksheet/tc_row.rb +32 -14
- data/test/workbook/worksheet/tc_selection.rb +94 -0
- data/test/workbook/worksheet/tc_sheet_protection.rb +117 -0
- data/test/workbook/worksheet/tc_sheet_view.rb +214 -0
- data/test/workbook/worksheet/tc_worksheet.rb +138 -48
- metadata +140 -80
- data/examples/#extractive.csv# +0 -0
- data/examples/#extractive.rb# +0 -45
- data/examples/chart_colors.rb~ +0 -0
- data/examples/chart_colors.xlsx +0 -0
- data/examples/colored_series_data.xlsx +0 -0
- data/examples/conditional_formatting/getting_barred.xlsx +0 -0
- data/examples/example.csv +0 -1000
- data/examples/extractive.csv +0 -1
- data/examples/extractive.csv~ +0 -1
- data/examples/extractive.rb~ +0 -3
- data/examples/extractive.xlsx +0 -0
- data/examples/stack.rb +0 -21
- data/examples/stack.rb~ +0 -27
- data/examples/stack.xlsx +0 -0
- data/examples/~$chart_colors.xlsx +0 -0
- data/examples/~$extractive.xlsx +0 -0
- data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
- data/lib/axlsx/drawing/data_source.rb~ +0 -51
- data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
- data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
- data/lib/axlsx/drawing/num_data.rb~ +0 -51
- data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
- data/lib/axlsx/drawing/num_val.rb~ +0 -40
- data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
- data/lib/axlsx/drawing/ref.rb~ +0 -41
- data/lib/axlsx/drawing/str_data.rb~ +0 -58
- data/lib/axlsx/drawing/str_val.rb~ +0 -35
- data/lib/axlsx/util/cbf.rb +0 -333
- data/lib/axlsx/util/cfb.rb~ +0 -201
- data/lib/axlsx/util/font_tables.rb~ +0 -0
- data/lib/axlsx/util/ms_off_crypto.rb +0 -189
- data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
- data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
- data/lib/axlsx/util/parser.rb~ +0 -6
- data/lib/axlsx/util/storage.rb~ +0 -0
- data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
- data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
- data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
- data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
- data/lib/schema/dc.xsd~ +0 -118
- data/lib/schema/dcterms.xsd~ +0 -331
- data/lib/schema/opc-coreProperties.xsd~ +0 -50
- data/test/drawing/tc_data_source.rb~ +0 -30
- data/test/drawing/tc_num_data.rb~ +0 -35
- data/test/drawing/tc_num_val.rb~ +0 -29
- data/test/drawing/tc_str_data.rb~ +0 -30
- data/test/drawing/tc_str_val.rb~ +0 -26
- data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
- data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
- data/test/workbook/worksheet/tc_col.rb~ +0 -10
- data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
- data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
- data/test/workbook/worksheet/tc_icon_set.rb~ +0 -0
data/lib/axlsx/doc_props/app.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
|
+
|
|
3
4
|
# App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object.
|
|
4
5
|
# @see shared-documentPropertiesExtended.xsd
|
|
5
6
|
# @note Support is not implemented for the following complex types:
|
|
@@ -10,166 +11,222 @@ module Axlsx
|
|
|
10
11
|
# DigSig (DigSigBlob)
|
|
11
12
|
class App
|
|
12
13
|
|
|
14
|
+
# Creates an App object
|
|
15
|
+
# @option options [String] template
|
|
16
|
+
# @option options [String] manager
|
|
17
|
+
# @option options [Integer] pages
|
|
18
|
+
# @option options [Integer] words
|
|
19
|
+
# @option options [Integer] characters
|
|
20
|
+
# @option options [String] presentation_format
|
|
21
|
+
# @option options [Integer] lines
|
|
22
|
+
# @option options [Integer] paragraphs
|
|
23
|
+
# @option options [Integer] slides
|
|
24
|
+
# @option options [Integer] notes
|
|
25
|
+
# @option options [Integer] total_time
|
|
26
|
+
# @option options [Integer] hidden_slides
|
|
27
|
+
# @option options [Integer] m_m_clips
|
|
28
|
+
# @option options [Boolean] scale_crop
|
|
29
|
+
# @option options [Boolean] links_up_to_date
|
|
30
|
+
# @option options [Integer] characters_with_spaces
|
|
31
|
+
# @option options [Boolean] share_doc
|
|
32
|
+
# @option options [String] hyperlink_base
|
|
33
|
+
# @option options [String] hyperlinks_changed
|
|
34
|
+
# @option options [String] application
|
|
35
|
+
# @option options [String] app_version
|
|
36
|
+
# @option options [Integer] doc_security
|
|
37
|
+
def initialize(options={})
|
|
38
|
+
options.each do |name, value|
|
|
39
|
+
self.send("#{name}=", value) if self.respond_to? "#{name}="
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
13
43
|
# @return [String] The name of the document template.
|
|
14
|
-
attr_reader :
|
|
44
|
+
attr_reader :template
|
|
45
|
+
alias :Template :template
|
|
15
46
|
|
|
16
47
|
# @return [String] The name of the manager for the document.
|
|
17
|
-
attr_reader :
|
|
48
|
+
attr_reader :manager
|
|
49
|
+
alias :Manager :manager
|
|
18
50
|
|
|
19
51
|
# @return [String] The name of the company generating the document.
|
|
20
|
-
attr_reader :
|
|
52
|
+
attr_reader :company
|
|
53
|
+
alias :Company :company
|
|
21
54
|
|
|
22
55
|
# @return [Integer] The number of pages in the document.
|
|
23
|
-
attr_reader :
|
|
56
|
+
attr_reader :pages
|
|
57
|
+
alias :Pages :pages
|
|
24
58
|
|
|
25
59
|
# @return [Integer] The number of words in the document.
|
|
26
|
-
attr_reader :
|
|
60
|
+
attr_reader :words
|
|
61
|
+
alias :Words :words
|
|
27
62
|
|
|
28
63
|
# @return [Integer] The number of characters in the document.
|
|
29
|
-
attr_reader :
|
|
64
|
+
attr_reader :characters
|
|
65
|
+
alias :Characters :characters
|
|
30
66
|
|
|
31
67
|
# @return [String] The intended format of the presentation.
|
|
32
|
-
attr_reader :
|
|
68
|
+
attr_reader :presentation_format
|
|
69
|
+
alias :PresentationFormat :presentation_format
|
|
33
70
|
|
|
34
71
|
# @return [Integer] The number of lines in the document.
|
|
35
|
-
attr_reader :
|
|
72
|
+
attr_reader :lines
|
|
73
|
+
alias :Lines :lines
|
|
36
74
|
|
|
37
75
|
# @return [Integer] The number of paragraphs in the document
|
|
38
|
-
attr_reader :
|
|
76
|
+
attr_reader :paragraphs
|
|
77
|
+
alias :Paragraphs :paragraphs
|
|
39
78
|
|
|
40
79
|
# @return [Intger] The number of slides in the document.
|
|
41
|
-
attr_reader :
|
|
80
|
+
attr_reader :slides
|
|
81
|
+
alias :Slides :slides
|
|
42
82
|
|
|
43
83
|
# @return [Integer] The number of slides that have notes.
|
|
44
|
-
attr_reader :
|
|
84
|
+
attr_reader :notes
|
|
85
|
+
alias :Notes :notes
|
|
45
86
|
|
|
46
87
|
# @return [Integer] The total amount of time spent editing.
|
|
47
|
-
attr_reader :
|
|
88
|
+
attr_reader :total_time
|
|
89
|
+
alias :TotalTime :total_time
|
|
48
90
|
|
|
49
91
|
# @return [Integer] The number of hidden slides.
|
|
50
|
-
attr_reader :
|
|
92
|
+
attr_reader :hidden_slides
|
|
93
|
+
alias :HiddenSlides :hidden_slides
|
|
51
94
|
|
|
52
95
|
# @return [Integer] The total number multimedia clips
|
|
53
|
-
attr_reader :
|
|
96
|
+
attr_reader :m_m_clips
|
|
97
|
+
alias :MMClips :m_m_clips
|
|
54
98
|
|
|
55
99
|
# @return [Boolean] The display mode for the document thumbnail.
|
|
56
|
-
attr_reader :
|
|
100
|
+
attr_reader :scale_crop
|
|
101
|
+
alias :ScaleCrop :scale_crop
|
|
57
102
|
|
|
58
103
|
# @return [Boolean] The links in the document are up to date.
|
|
59
|
-
attr_reader :
|
|
104
|
+
attr_reader :links_up_to_date
|
|
105
|
+
alias :LinksUpToDate :links_up_to_date
|
|
60
106
|
|
|
61
107
|
# @return [Integer] The number of characters in the document including spaces.
|
|
62
|
-
attr_reader :
|
|
108
|
+
attr_reader :characters_with_spaces
|
|
109
|
+
alias :CharactersWithSpaces :characters_with_spaces
|
|
63
110
|
|
|
64
111
|
# @return [Boolean] Indicates if the document is shared.
|
|
65
|
-
attr_reader :
|
|
112
|
+
attr_reader :shared_doc
|
|
113
|
+
alias :SharedDoc :shared_doc
|
|
66
114
|
|
|
67
115
|
# @return [String] The base for hyper links in the document.
|
|
68
|
-
attr_reader :
|
|
116
|
+
attr_reader :hyperlink_base
|
|
117
|
+
alias :HyperlinkBase :hyperlink_base
|
|
69
118
|
|
|
70
119
|
# @return [Boolean] Indicates that the hyper links in the document have been changed.
|
|
71
|
-
attr_reader :
|
|
120
|
+
attr_reader :hyperlinks_changed
|
|
121
|
+
alias :HyperlinksChanged :hyperlinks_changed
|
|
72
122
|
|
|
73
123
|
# @return [String] The name of the application
|
|
74
|
-
attr_reader :
|
|
124
|
+
attr_reader :application
|
|
125
|
+
alias :Applicatoin :application
|
|
75
126
|
|
|
76
127
|
# @return [String] The version of the application.
|
|
77
|
-
attr_reader :
|
|
128
|
+
attr_reader :app_version
|
|
129
|
+
alias :AppVersion :app_version
|
|
78
130
|
|
|
79
131
|
# @return [Integer] Document security
|
|
80
|
-
attr_reader :
|
|
132
|
+
attr_reader :doc_security
|
|
133
|
+
alias :DocSecurity :doc_security
|
|
81
134
|
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
#
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
#
|
|
105
|
-
def
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
end
|
|
135
|
+
# Sets the template property of your app.xml file
|
|
136
|
+
def template=(v) Axlsx::validate_string v; @template = v; end
|
|
137
|
+
alias :Template :template
|
|
138
|
+
|
|
139
|
+
# Sets the manager property of your app.xml file
|
|
140
|
+
def manager=(v) Axlsx::validate_string v; @manager = v; end
|
|
141
|
+
alias :Manager :manager
|
|
142
|
+
|
|
143
|
+
# Sets the company property of your app.xml file
|
|
144
|
+
def company=(v) Axlsx::validate_string v; @company = v; end
|
|
145
|
+
alias :Company :company
|
|
146
|
+
# Sets the pages property of your app.xml file
|
|
147
|
+
def pages=(v) Axlsx::validate_int v; @pages = v; end
|
|
148
|
+
|
|
149
|
+
# Sets the words property of your app.xml file
|
|
150
|
+
def words=(v) Axlsx::validate_int v; @words = v; end
|
|
151
|
+
alias :Words= :words=
|
|
152
|
+
|
|
153
|
+
# Sets the characters property of your app.xml file
|
|
154
|
+
def characters=(v) Axlsx::validate_int v; @characters = v; end
|
|
155
|
+
alias :Characters= :characters=
|
|
156
|
+
|
|
157
|
+
# Sets the presentation_format property of your app.xml file
|
|
158
|
+
def presentation_format=(v) Axlsx::validate_string v; @presentation_format = v; end
|
|
159
|
+
alias :PresentationFormat= :presentation_format=
|
|
160
|
+
|
|
161
|
+
# Sets the lines property of your app.xml file
|
|
162
|
+
def lines=(v) Axlsx::validate_int v; @lines = v; end
|
|
163
|
+
alias :Lines= :lines=
|
|
164
|
+
|
|
165
|
+
# Sets the paragraphs property of your app.xml file
|
|
166
|
+
def paragraphs=(v) Axlsx::validate_int v; @paragraphs = v; end
|
|
167
|
+
alias :Paragraphs= :paragraphs=
|
|
168
|
+
|
|
169
|
+
# sets the slides property of your app.xml file
|
|
170
|
+
def slides=(v) Axlsx::validate_int v; @slides = v; end
|
|
171
|
+
alias :Slides= :slides=
|
|
172
|
+
|
|
173
|
+
# sets the notes property of your app.xml file
|
|
174
|
+
def notes=(v) Axlsx::validate_int v; @notes = v; end
|
|
175
|
+
alias :Notes= :notes=
|
|
176
|
+
|
|
177
|
+
# Sets the total_time property of your app.xml file
|
|
178
|
+
def total_time=(v) Axlsx::validate_int v; @total_time = v; end
|
|
179
|
+
alias :TotalTime= :total_time=
|
|
180
|
+
|
|
181
|
+
# Sets the hidden_slides property of your app.xml file
|
|
182
|
+
def hidden_slides=(v) Axlsx::validate_int v; @hidden_slides = v; end
|
|
183
|
+
alias :HiddenSlides= :hidden_slides=
|
|
184
|
+
|
|
185
|
+
# Sets the m_m_clips property of your app.xml file
|
|
186
|
+
def m_m_clips=(v) Axlsx::validate_int v; @m_m_clips = v; end
|
|
187
|
+
alias :MMClips= :m_m_clips=
|
|
188
|
+
|
|
189
|
+
# Sets the scale_crop property of your app.xml file
|
|
190
|
+
def scale_crop=(v) Axlsx::validate_boolean v; @scale_crop = v; end
|
|
191
|
+
alias :ScaleCrop= :scale_crop=
|
|
192
|
+
|
|
193
|
+
# Sets the links_up_to_date property of your app.xml file
|
|
194
|
+
def links_up_to_date=(v) Axlsx::validate_boolean v; @links_up_to_date = v; end
|
|
195
|
+
alias :LinksUpToDate= :links_up_to_date=
|
|
196
|
+
|
|
197
|
+
# Sets the characters_with_spaces property of your app.xml file
|
|
198
|
+
def characters_with_spaces=(v) Axlsx::validate_int v; @characters_with_spaces = v; end
|
|
199
|
+
alias :CharactersWithSpaces= :characters_with_spaces=
|
|
200
|
+
|
|
201
|
+
# Sets the share_doc property of your app.xml file
|
|
202
|
+
def shared_doc=(v) Axlsx::validate_boolean v; @shared_doc = v; end
|
|
203
|
+
alias :SharedDoc= :shared_doc=
|
|
204
|
+
|
|
205
|
+
# Sets the hyperlink_base property of your app.xml file
|
|
206
|
+
def hyperlink_base=(v) Axlsx::validate_string v; @hyperlink_base = v; end
|
|
207
|
+
alias :HyperlinkBase= :hyperlink_base=
|
|
110
208
|
|
|
111
|
-
# Sets the Template property of your app.xml file
|
|
112
|
-
def Template=(v) Axlsx::validate_string v; @Template = v; end
|
|
113
|
-
|
|
114
|
-
# Sets the Manager property of your app.xml file
|
|
115
|
-
def Manager=(v) Axlsx::validate_string v; @Manager = v; end
|
|
116
|
-
|
|
117
|
-
# Sets the Company property of your app.xml file
|
|
118
|
-
def Company=(v) Axlsx::validate_string v; @Company = v; end
|
|
119
|
-
|
|
120
|
-
# Sets the Pages property of your app.xml file
|
|
121
|
-
def Pages=(v) Axlsx::validate_int v; @Pages = v; end
|
|
122
|
-
|
|
123
|
-
# Sets the Words property of your app.xml file
|
|
124
|
-
def Words=(v) Axlsx::validate_int v; @Words = v; end
|
|
125
|
-
|
|
126
|
-
# Sets the Characters property of your app.xml file
|
|
127
|
-
def Characters=(v) Axlsx::validate_int v; @Characters = v; end
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
# Sets the PresentationFormat property of your app.xml file
|
|
131
|
-
def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end
|
|
132
|
-
# Sets the Lines property of your app.xml file
|
|
133
|
-
def Lines=(v) Axlsx::validate_int v; @Lines = v; end
|
|
134
|
-
# Sets the Paragraphs property of your app.xml file
|
|
135
|
-
def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end
|
|
136
|
-
# Sets the Slides property of your app.xml file
|
|
137
|
-
def Slides=(v) Axlsx::validate_int v; @Slides = v; end
|
|
138
|
-
# Sets the Notes property of your app.xml file
|
|
139
|
-
def Notes=(v) Axlsx::validate_int v; @Notes = v; end
|
|
140
|
-
# Sets the TotalTime property of your app.xml file
|
|
141
|
-
def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end
|
|
142
|
-
# Sets the HiddenSlides property of your app.xml file
|
|
143
|
-
def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end
|
|
144
|
-
# Sets the MMClips property of your app.xml file
|
|
145
|
-
def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end
|
|
146
|
-
# Sets the ScaleCrop property of your app.xml file
|
|
147
|
-
def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end
|
|
148
|
-
# Sets the LinksUpToDate property of your app.xml file
|
|
149
|
-
def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end
|
|
150
|
-
# Sets the CharactersWithSpaces property of your app.xml file
|
|
151
|
-
def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end
|
|
152
|
-
# Sets the ShareDoc property of your app.xml file
|
|
153
|
-
def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end
|
|
154
|
-
# Sets the HyperLinkBase property of your app.xml file
|
|
155
|
-
def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end
|
|
156
209
|
# Sets the HyperLinksChanged property of your app.xml file
|
|
157
|
-
def
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# Sets the
|
|
161
|
-
def
|
|
162
|
-
|
|
163
|
-
|
|
210
|
+
def hyperlinks_changed=(v) Axlsx::validate_boolean v; @hyperlinks_changed = v; end
|
|
211
|
+
alias :HyperLinksChanged= :hyperlinks_changed=
|
|
212
|
+
|
|
213
|
+
# Sets the app_version property of your app.xml file
|
|
214
|
+
def app_version=(v) Axlsx::validate_string v; @app_version = v; end
|
|
215
|
+
alias :AppVersion= :app_version=
|
|
216
|
+
|
|
217
|
+
# Sets the doc_security property of your app.xml file
|
|
218
|
+
def doc_security=(v) Axlsx::validate_int v; @doc_security = v; end
|
|
219
|
+
alias :DocSecurity= :doc_security=
|
|
164
220
|
|
|
165
221
|
# Serialize the app.xml document
|
|
166
222
|
# @return [String]
|
|
167
223
|
def to_xml_string(str = '')
|
|
168
224
|
str << '<?xml version="1.0" encoding="UTF-8"?>'
|
|
169
225
|
str << '<Properties xmlns="' << APP_NS << '" xmlns:vt="' << APP_NS_VT << '">'
|
|
170
|
-
str << instance_values.map { |key, value| '<' << key
|
|
226
|
+
str << instance_values.map { |key, value| '<' << Axlsx.camel(key) << '>' << value.to_s << '</' << Axlsx.camel(key) << '>' }.join
|
|
171
227
|
str << '</Properties>'
|
|
172
228
|
end
|
|
173
229
|
|
|
174
230
|
end
|
|
231
|
+
|
|
175
232
|
end
|
data/lib/axlsx/doc_props/core.rb
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
|
+
|
|
3
4
|
# The core object for the package.
|
|
4
5
|
# @note Packages manage their own core object.
|
|
5
6
|
# @see Package#core
|
|
6
7
|
class Core
|
|
7
|
-
|
|
8
|
-
# @return [String]
|
|
9
|
-
attr_accessor :creator
|
|
10
|
-
|
|
8
|
+
|
|
11
9
|
# Creates a new Core object.
|
|
12
10
|
# @option options [String] creator
|
|
13
11
|
def initialize(options={})
|
|
14
12
|
@creator = options[:creator] || 'axlsx'
|
|
15
13
|
end
|
|
16
14
|
|
|
15
|
+
# The author of the document. By default this is 'axlsx'
|
|
16
|
+
# @return [String]
|
|
17
|
+
attr_accessor :creator
|
|
18
|
+
|
|
17
19
|
# serializes the core.xml document
|
|
18
20
|
# @return [String]
|
|
19
21
|
def to_xml_string(str = '')
|
|
@@ -22,9 +24,11 @@ module Axlsx
|
|
|
22
24
|
str << 'xmlns:dcmitype="' << CORE_NS_DCMIT << '" xmlns:dcterms="' << CORE_NS_DCT << '" '
|
|
23
25
|
str << 'xmlns:xsi="' << CORE_NS_XSI << '">'
|
|
24
26
|
str << '<dc:creator>' << self.creator << '</dc:creator>'
|
|
25
|
-
str << '<dcterms:created xsi:type="dcterms:W3CDTF">' << Time.now.strftime('%Y-%m-%dT%H:%M:%S') << '</dcterms:created>'
|
|
27
|
+
str << '<dcterms:created xsi:type="dcterms:W3CDTF">' << Time.now.strftime('%Y-%m-%dT%H:%M:%S') << 'Z</dcterms:created>'
|
|
26
28
|
str << '<cp:revision>0</cp:revision>'
|
|
27
29
|
str << '</cp:coreProperties>'
|
|
28
30
|
end
|
|
31
|
+
|
|
29
32
|
end
|
|
33
|
+
|
|
30
34
|
end
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
module Axlsx
|
|
2
|
+
|
|
2
3
|
# An axis data source that can contain referenced or literal strings or numbers
|
|
3
4
|
# @note only string data types are supported - mainly because we have not implemented a chart type that requires a numerical axis value
|
|
4
5
|
class AxDataSource < NumDataSource
|
|
5
6
|
|
|
6
|
-
# allowed element tag names
|
|
7
|
-
# @return [Array]
|
|
8
|
-
def self.allowed_tag_names
|
|
9
|
-
[:xVal, :cat]
|
|
10
|
-
end
|
|
11
|
-
|
|
12
7
|
# creates a new NumDataSource object
|
|
13
8
|
# @option options [Array] data An array of Cells or Numeric objects
|
|
14
9
|
# @option options [Symbol] tag_name see tag_name
|
|
@@ -19,6 +14,12 @@ module Axlsx
|
|
|
19
14
|
super(options)
|
|
20
15
|
end
|
|
21
16
|
|
|
17
|
+
# allowed element tag names for serialization
|
|
18
|
+
# @return [Array]
|
|
19
|
+
def self.allowed_tag_names
|
|
20
|
+
[:xVal, :cat]
|
|
21
|
+
end
|
|
22
|
+
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
end
|
data/lib/axlsx/drawing/axis.rb
CHANGED
|
@@ -1,15 +1,49 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
module Axlsx
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
# the access class defines common properties and values for a chart axis.
|
|
4
5
|
class Axis
|
|
5
6
|
|
|
7
|
+
# Creates an Axis object
|
|
8
|
+
# @param [Integer] ax_id the id of this axis
|
|
9
|
+
# @param [Integer] cross_ax the id of the perpendicular axis
|
|
10
|
+
# @option options [Symbol] ax_pos
|
|
11
|
+
# @option options [Symbol] crosses
|
|
12
|
+
# @option options [Symbol] tick_lbl_pos
|
|
13
|
+
# @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
|
|
14
|
+
def initialize(ax_id, cross_ax, options={})
|
|
15
|
+
Axlsx::validate_unsigned_int(ax_id)
|
|
16
|
+
Axlsx::validate_unsigned_int(cross_ax)
|
|
17
|
+
@ax_id = ax_id
|
|
18
|
+
@cross_ax = cross_ax
|
|
19
|
+
@format_code = "General"
|
|
20
|
+
@delete = @label_rotation = 0
|
|
21
|
+
@scaling = Scaling.new(:orientation=>:minMax)
|
|
22
|
+
@title = @color = nil
|
|
23
|
+
self.ax_pos = :b
|
|
24
|
+
self.tick_lbl_pos = :nextTo
|
|
25
|
+
self.format_code = "General"
|
|
26
|
+
self.crosses = :autoZero
|
|
27
|
+
self.gridlines = true
|
|
28
|
+
options.each do |name, value|
|
|
29
|
+
self.send("#{name}=", value) if self.respond_to? "#{name}="
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# the fill color to use in the axis shape properties. This should be a 6 character long hex string
|
|
34
|
+
# e.g. FF0000 for red
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_reader :color
|
|
37
|
+
|
|
6
38
|
# the id of the axis.
|
|
7
39
|
# @return [Integer]
|
|
8
|
-
attr_reader :
|
|
40
|
+
attr_reader :ax_id
|
|
41
|
+
alias :axID :ax_id
|
|
9
42
|
|
|
10
43
|
# The perpendicular axis
|
|
11
44
|
# @return [Integer]
|
|
12
|
-
attr_reader :
|
|
45
|
+
attr_reader :cross_ax
|
|
46
|
+
alias :crossAx :cross_ax
|
|
13
47
|
|
|
14
48
|
# The scaling of the axis
|
|
15
49
|
# @see Scaling
|
|
@@ -19,12 +53,14 @@ module Axlsx
|
|
|
19
53
|
# The position of the axis
|
|
20
54
|
# must be one of [:l, :r, :t, :b]
|
|
21
55
|
# @return [Symbol]
|
|
22
|
-
attr_reader :
|
|
56
|
+
attr_reader :ax_pos
|
|
57
|
+
alias :axPos :ax_pos
|
|
23
58
|
|
|
24
59
|
# the position of the tick labels
|
|
25
60
|
# must be one of [:nextTo, :high, :low]
|
|
26
61
|
# @return [Symbol]
|
|
27
|
-
attr_reader :
|
|
62
|
+
attr_reader :tick_lbl_pos
|
|
63
|
+
alias :tickLblPos :tick_lbl_pos
|
|
28
64
|
|
|
29
65
|
# The number format format code for this axis
|
|
30
66
|
# default :General
|
|
@@ -48,37 +84,26 @@ module Axlsx
|
|
|
48
84
|
# @return [Boolean]
|
|
49
85
|
attr_reader :delete
|
|
50
86
|
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
# @
|
|
57
|
-
# @
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
Axlsx::validate_unsigned_int(crossAx)
|
|
61
|
-
@axId = axId
|
|
62
|
-
@crossAx = crossAx
|
|
63
|
-
@format_code = "General"
|
|
64
|
-
@delete = @label_rotation = 0
|
|
65
|
-
@scaling = Scaling.new(:orientation=>:minMax)
|
|
66
|
-
self.axPos = :b
|
|
67
|
-
self.tickLblPos = :nextTo
|
|
68
|
-
self.format_code = "General"
|
|
69
|
-
self.crosses = :autoZero
|
|
70
|
-
self.gridlines = true
|
|
71
|
-
options.each do |o|
|
|
72
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
|
73
|
-
end
|
|
87
|
+
# the title for the axis. This can be a cell or a fixed string.
|
|
88
|
+
attr_reader :title
|
|
89
|
+
|
|
90
|
+
# The color for this axis. This value is used when rendering the axis line in the chart.
|
|
91
|
+
# colors should be in 6 character rbg format
|
|
92
|
+
# @return [String] the rbg color assinged.
|
|
93
|
+
# @see color
|
|
94
|
+
def color=(color_rgb)
|
|
95
|
+
@color = color_rgb
|
|
74
96
|
end
|
|
97
|
+
|
|
75
98
|
# The position of the axis
|
|
76
99
|
# must be one of [:l, :r, :t, :b]
|
|
77
|
-
def
|
|
100
|
+
def ax_pos=(v) RestrictionValidator.validate "#{self.class}.ax_pos", [:l, :r, :b, :t], v; @ax_pos = v; end
|
|
101
|
+
alias :axPos= :ax_pos=
|
|
78
102
|
|
|
79
103
|
# the position of the tick labels
|
|
80
104
|
# must be one of [:nextTo, :high, :low1]
|
|
81
|
-
def
|
|
105
|
+
def tick_lbl_pos=(v) RestrictionValidator.validate "#{self.class}.tick_lbl_pos", [:nextTo, :high, :low], v; @tick_lbl_pos = v; end
|
|
106
|
+
alias :tickLblPos= :tick_lbl_pos=
|
|
82
107
|
|
|
83
108
|
# The number format format code for this axis
|
|
84
109
|
# default :General
|
|
@@ -88,7 +113,6 @@ module Axlsx
|
|
|
88
113
|
# default true
|
|
89
114
|
def gridlines=(v) Axlsx::validate_boolean(v); @gridlines = v; end
|
|
90
115
|
|
|
91
|
-
|
|
92
116
|
# Specify if axis should be removed from the chart
|
|
93
117
|
# default false
|
|
94
118
|
def delete=(v) Axlsx::validate_boolean(v); @delete = v; end
|
|
@@ -106,17 +130,30 @@ module Axlsx
|
|
|
106
130
|
@label_rotation = adjusted
|
|
107
131
|
end
|
|
108
132
|
|
|
133
|
+
# The title object for the chart.
|
|
134
|
+
# @param [String, Cell] v
|
|
135
|
+
# @return [Title]
|
|
136
|
+
def title=(v)
|
|
137
|
+
DataTypeValidator.validate "#{self.class}.title", [String, Cell], v
|
|
138
|
+
@title ||= Title.new
|
|
139
|
+
if v.is_a?(String)
|
|
140
|
+
@title.text = v
|
|
141
|
+
elsif v.is_a?(Cell)
|
|
142
|
+
@title.cell = v
|
|
143
|
+
end
|
|
144
|
+
end
|
|
109
145
|
|
|
110
146
|
# Serializes the object
|
|
111
147
|
# @param [String] str
|
|
112
148
|
# @return [String]
|
|
113
149
|
def to_xml_string(str = '')
|
|
114
|
-
str << '<c:axId val="' << @
|
|
150
|
+
str << '<c:axId val="' << @ax_id.to_s << '"/>'
|
|
115
151
|
@scaling.to_xml_string str
|
|
116
152
|
str << '<c:delete val="'<< @delete.to_s << '"/>'
|
|
117
|
-
str << '<c:axPos val="' << @
|
|
153
|
+
str << '<c:axPos val="' << @ax_pos.to_s << '"/>'
|
|
118
154
|
str << '<c:majorGridlines>'
|
|
119
|
-
|
|
155
|
+
# TODO shape properties need to be extracted into a class
|
|
156
|
+
if gridlines == false
|
|
120
157
|
str << '<c:spPr>'
|
|
121
158
|
str << '<a:ln>'
|
|
122
159
|
str << '<a:noFill/>'
|
|
@@ -124,15 +161,24 @@ module Axlsx
|
|
|
124
161
|
str << '</c:spPr>'
|
|
125
162
|
end
|
|
126
163
|
str << '</c:majorGridlines>'
|
|
164
|
+
@title.to_xml_string(str) unless @title == nil
|
|
127
165
|
str << '<c:numFmt formatCode="' << @format_code << '" sourceLinked="1"/>'
|
|
128
166
|
str << '<c:majorTickMark val="none"/>'
|
|
129
167
|
str << '<c:minorTickMark val="none"/>'
|
|
130
|
-
str << '<c:tickLblPos val="' << @
|
|
168
|
+
str << '<c:tickLblPos val="' << @tick_lbl_pos.to_s << '"/>'
|
|
169
|
+
# TODO - this is also being used for series colors
|
|
170
|
+
# time to extract this into a class spPr - Shape Properties
|
|
171
|
+
if @color
|
|
172
|
+
str << '<c:spPr><a:ln><a:solidFill>'
|
|
173
|
+
str << '<a:srgbClr val="' << @color << '"/>'
|
|
174
|
+
str << '</a:solidFill></a:ln></c:spPr>'
|
|
175
|
+
end
|
|
131
176
|
# some potential value in implementing this in full. Very detailed!
|
|
132
177
|
str << '<c:txPr><a:bodyPr rot="' << @label_rotation.to_s << '"/><a:lstStyle/><a:p><a:pPr><a:defRPr/></a:pPr><a:endParaRPr/></a:p></c:txPr>'
|
|
133
|
-
str << '<c:crossAx val="' << @
|
|
178
|
+
str << '<c:crossAx val="' << @cross_ax.to_s << '"/>'
|
|
134
179
|
str << '<c:crosses val="' << @crosses.to_s << '"/>'
|
|
135
180
|
end
|
|
136
181
|
|
|
137
182
|
end
|
|
183
|
+
|
|
138
184
|
end
|