axlsx 1.1.6 → 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.
Files changed (173) hide show
  1. data/.yardopts +5 -2
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +97 -46
  4. data/Rakefile +3 -2
  5. data/examples/basic_charts.rb +54 -0
  6. data/examples/chart_colors.rb +18 -3
  7. data/examples/example.rb +118 -42
  8. data/examples/example.xlsx +0 -0
  9. data/examples/example_streamed.xlsx +0 -0
  10. data/examples/extractive.pdf +0 -0
  11. data/examples/no-use_autowidth.xlsx +0 -0
  12. data/examples/scraping_html.rb +91 -0
  13. data/examples/shared_strings_example.xlsx +0 -0
  14. data/examples/sheet_view.rb +34 -0
  15. data/lib/axlsx/content_type/content_type.rb +2 -0
  16. data/lib/axlsx/content_type/default.rb +21 -12
  17. data/lib/axlsx/content_type/override.rb +22 -11
  18. data/lib/axlsx/doc_props/app.rb +36 -32
  19. data/lib/axlsx/doc_props/core.rb +9 -5
  20. data/lib/axlsx/drawing/ax_data_source.rb +7 -6
  21. data/lib/axlsx/drawing/axis.rb +64 -25
  22. data/lib/axlsx/drawing/bar_3D_chart.rb +49 -45
  23. data/lib/axlsx/drawing/bar_series.rb +1 -0
  24. data/lib/axlsx/drawing/cat_axis.rb +43 -39
  25. data/lib/axlsx/drawing/chart.rb +65 -54
  26. data/lib/axlsx/drawing/d_lbls.rb +100 -0
  27. data/lib/axlsx/drawing/drawing.rb +7 -5
  28. data/lib/axlsx/drawing/graphic_frame.rb +2 -2
  29. data/lib/axlsx/drawing/line_3D_chart.rb +3 -10
  30. data/lib/axlsx/drawing/num_data.rb +2 -2
  31. data/lib/axlsx/drawing/num_data_source.rb +1 -1
  32. data/lib/axlsx/drawing/pie_3D_chart.rb +10 -7
  33. data/lib/axlsx/drawing/scatter_chart.rb +2 -8
  34. data/lib/axlsx/drawing/title.rb +21 -9
  35. data/lib/axlsx/drawing/two_cell_anchor.rb +41 -9
  36. data/lib/axlsx/drawing/view_3D.rb +41 -31
  37. data/lib/axlsx/drawing/vml_drawing.rb +1 -1
  38. data/lib/axlsx/package.rb +20 -16
  39. data/lib/axlsx/rels/relationship.rb +3 -3
  40. data/lib/axlsx/stylesheet/styles.rb +1 -1
  41. data/lib/axlsx/util/constants.rb +4 -0
  42. data/lib/axlsx/util/simple_typed_list.rb +15 -8
  43. data/lib/axlsx/util/validators.rb +28 -4
  44. data/lib/axlsx/version.rb +2 -7
  45. data/lib/axlsx/workbook/defined_name.rb +174 -0
  46. data/lib/axlsx/workbook/defined_names.rb +21 -0
  47. data/lib/axlsx/workbook/workbook.rb +46 -17
  48. data/lib/axlsx/workbook/worksheet/auto_filter.rb +34 -0
  49. data/lib/axlsx/workbook/worksheet/cell.rb +28 -1
  50. data/lib/axlsx/workbook/worksheet/col.rb +15 -0
  51. data/lib/axlsx/workbook/worksheet/cols.rb +20 -0
  52. data/lib/axlsx/workbook/worksheet/comments.rb +8 -0
  53. data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +25 -0
  54. data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
  55. data/lib/axlsx/workbook/worksheet/data_validations.rb +28 -0
  56. data/lib/axlsx/workbook/worksheet/dimension.rb +65 -0
  57. data/lib/axlsx/workbook/worksheet/merged_cells.rb +35 -0
  58. data/lib/axlsx/workbook/worksheet/page_setup.rb +10 -1
  59. data/lib/axlsx/workbook/worksheet/pane.rb +144 -0
  60. data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
  61. data/lib/axlsx/workbook/worksheet/protected_ranges.rb +34 -0
  62. data/lib/axlsx/workbook/worksheet/row.rb +1 -1
  63. data/lib/axlsx/workbook/worksheet/selection.rb +111 -0
  64. data/lib/axlsx/workbook/worksheet/sheet_data.rb +25 -0
  65. data/lib/axlsx/workbook/worksheet/sheet_pr.rb +24 -0
  66. data/lib/axlsx/workbook/worksheet/sheet_view.rb +379 -0
  67. data/lib/axlsx/workbook/worksheet/tables.rb +31 -0
  68. data/lib/axlsx/workbook/worksheet/worksheet.rb +315 -291
  69. data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +57 -0
  70. data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +64 -0
  71. data/lib/axlsx.rb +24 -16
  72. data/test/content_type/tc_content_type.rb +1 -6
  73. data/test/doc_props/tc_core.rb +1 -1
  74. data/test/drawing/tc_axis.rb +27 -2
  75. data/test/drawing/tc_bar_3D_chart.rb +12 -12
  76. data/test/drawing/tc_bar_series.rb +1 -2
  77. data/test/drawing/tc_cat_axis.rb +3 -3
  78. data/test/drawing/tc_chart.rb +8 -6
  79. data/test/drawing/tc_d_lbls.rb +47 -0
  80. data/test/drawing/tc_drawing.rb +5 -4
  81. data/test/drawing/tc_line_series.rb +1 -1
  82. data/test/drawing/tc_num_data.rb +5 -1
  83. data/test/drawing/tc_pie_3D_chart.rb +4 -8
  84. data/test/drawing/tc_pie_series.rb +1 -1
  85. data/test/drawing/tc_scatter_series.rb +1 -1
  86. data/test/drawing/tc_series.rb +1 -1
  87. data/test/drawing/tc_title.rb +16 -0
  88. data/test/drawing/tc_view_3D.rb +18 -18
  89. data/test/tc_package.rb +41 -4
  90. data/test/util/tc_validators.rb +68 -11
  91. data/test/workbook/tc_defined_name.rb +41 -0
  92. data/test/workbook/tc_workbook.rb +5 -3
  93. data/test/workbook/worksheet/table/tc_table.rb +0 -8
  94. data/test/workbook/worksheet/tc_cell.rb +2 -4
  95. data/test/workbook/worksheet/tc_page_setup.rb +20 -3
  96. data/test/workbook/worksheet/tc_pane.rb +94 -0
  97. data/test/workbook/worksheet/tc_protected_range.rb +17 -0
  98. data/test/workbook/worksheet/tc_row.rb +2 -2
  99. data/test/workbook/worksheet/tc_selection.rb +94 -0
  100. data/test/workbook/worksheet/tc_sheet_view.rb +214 -0
  101. data/test/workbook/worksheet/tc_worksheet.rb +53 -41
  102. metadata +104 -97
  103. data/examples/chart_colors.xlsx +0 -0
  104. data/examples/conditional_formatting/getting_barred.xlsx +0 -0
  105. data/examples/doc/_index.html +0 -84
  106. data/examples/doc/class_list.html +0 -47
  107. data/examples/doc/css/common.css +0 -1
  108. data/examples/doc/css/full_list.css +0 -55
  109. data/examples/doc/css/style.css +0 -322
  110. data/examples/doc/file_list.html +0 -46
  111. data/examples/doc/frames.html +0 -13
  112. data/examples/doc/index.html +0 -84
  113. data/examples/doc/js/app.js +0 -205
  114. data/examples/doc/js/full_list.js +0 -173
  115. data/examples/doc/js/jquery.js +0 -16
  116. data/examples/doc/method_list.html +0 -46
  117. data/examples/doc/top-level-namespace.html +0 -95
  118. data/examples/examples_saved.xlsx +0 -0
  119. data/examples/fish.xlsx +0 -0
  120. data/examples/pareto.rb +0 -28
  121. data/examples/pareto.xlsx +0 -0
  122. data/examples/pie_chart.rb +0 -16
  123. data/examples/pie_chart.xlsx +0 -0
  124. data/examples/pie_chart_saved.xlsx +0 -0
  125. data/examples/sheet_protection.xlsx +0 -0
  126. data/examples/two_cell_anchor_image.xlsx +0 -0
  127. data/examples/~$pie_chart_saved.xlsx +0 -0
  128. data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
  129. data/lib/axlsx/drawing/data_source.rb~ +0 -51
  130. data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
  131. data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
  132. data/lib/axlsx/drawing/num_data.rb~ +0 -51
  133. data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
  134. data/lib/axlsx/drawing/num_val.rb~ +0 -40
  135. data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
  136. data/lib/axlsx/drawing/ref.rb~ +0 -41
  137. data/lib/axlsx/drawing/str_data.rb~ +0 -58
  138. data/lib/axlsx/drawing/str_val.rb~ +0 -35
  139. data/lib/axlsx/drawing/vml_drawing.rb~ +0 -6
  140. data/lib/axlsx/drawing/vml_shape.rb~ +0 -61
  141. data/lib/axlsx/util/cbf.rb +0 -333
  142. data/lib/axlsx/util/cfb.rb~ +0 -201
  143. data/lib/axlsx/util/font_tables.rb~ +0 -0
  144. data/lib/axlsx/util/ms_off_crypto.rb +0 -189
  145. data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
  146. data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
  147. data/lib/axlsx/util/parser.rb~ +0 -6
  148. data/lib/axlsx/util/storage.rb~ +0 -0
  149. data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
  150. data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
  151. data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
  152. data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
  153. data/lib/axlsx/workbook/worksheet/comment.rb~ +0 -91
  154. data/lib/axlsx/workbook/worksheet/comments.rb~ +0 -86
  155. data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
  156. data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
  157. data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
  158. data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
  159. data/lib/schema/dc.xsd~ +0 -118
  160. data/lib/schema/dcterms.xsd~ +0 -331
  161. data/lib/schema/opc-coreProperties.xsd~ +0 -50
  162. data/test/drawing/tc_data_source.rb~ +0 -30
  163. data/test/drawing/tc_num_data.rb~ +0 -35
  164. data/test/drawing/tc_num_val.rb~ +0 -29
  165. data/test/drawing/tc_str_data.rb~ +0 -30
  166. data/test/drawing/tc_str_val.rb~ +0 -26
  167. data/test/drawing/tc_vml_drawing.rb~ +0 -0
  168. data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
  169. data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
  170. data/test/workbook/worksheet/tc_col.rb~ +0 -10
  171. data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
  172. data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
  173. data/test/workbook/worksheet/tc_icon_set.rb~ +0 -0
@@ -1,55 +0,0 @@
1
- module Axlsx
2
- # An axis data source that can contain referenced or literal strings or numbers
3
- # @note only string data types are supported - mainly because we have not implemented a chart type that requires a numerical axis value
4
- class AxDataSource
5
-
6
- # The tag name to use when serializing this data source.
7
- # Only items defined in allowed_tag_names are allowed
8
- # @return [Symbol]
9
- attr_reader :tag_name
10
-
11
- attr_reader :data
12
-
13
- # allowed element tag names
14
- # @return [Array]
15
- def self.allowed_tag_names
16
- [:xVal, :cat]
17
- end
18
-
19
- # creates a new NumDataSource object
20
- # @option options [Array] data An array of Cells or Numeric objects
21
- # @option options [Symbol] tag_name see tag_name
22
- def initialize(options={})
23
- @f = nil
24
- @tag_name = :cat
25
- @data = StrData.new(options)
26
- if options[:data] && options[:data].first.is_a?(Cell)
27
- @f = Axlsx::cell_range(options[:data])
28
- end
29
- options.each do |o|
30
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
31
- end
32
- end
33
-
34
- # sets the tag name for this data source
35
- # @param [Symbol] One of the allowed_tag_names
36
- def tag_name=(v)
37
- Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v
38
- @tag_name = v
39
- end
40
-
41
- def to_xml_string(str="")
42
- str << '<c:' << tag_name.to_s << '>'
43
- if @f
44
- str << '<c:strRef>'
45
- str << '<c:f>' << @f.to_s << '</c:f>'
46
- end
47
- @data.to_xml_string str
48
- if @f
49
- str << '</c:strRef>'
50
- end
51
- str << '</c:' << tag_name.to_s << '>'
52
- end
53
- end
54
- end
55
-
@@ -1,51 +0,0 @@
1
- module Axlsx
2
-
3
- # Base class for xVal, yVal and val and cat data sources
4
- # @note xVal and cat are AxDataSource elements while yVal and val are NumDataSource elements
5
- # The difference being that with AxDataSource elements, the data can be numLit, numRef, strLit or strRef
6
- # while NumDataSource elements can only be numLit or numRef
7
- class DataSource
8
-
9
- def self.allowed_tag_names
10
- [:yVal, :xVal, :val, :cat]
11
- end
12
-
13
- def self.allowed_types
14
- [NumData, StrData]
15
- end
16
-
17
- attr_reader :tag_name
18
-
19
- attr_reader :data
20
-
21
- def initialize(type, data=[], options={})
22
- Axlsx::RestrictionValidator.validate "#{self.class.name}", self.class.allowed_types, type
23
- @data = type.new(:data = data)
24
- tag_name = :val
25
- options.each do |o|
26
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
27
- end
28
- end
29
-
30
- def tag_name=(v)
31
- Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v
32
- @tag_name = v
33
- end
34
-
35
- def f
36
- is_reference? ? Axlsx::cell_range(data) : ''
37
- end
38
-
39
- def is_reference?
40
- @data.first.is_a? Cell
41
- end
42
-
43
- def to_xml_string(str = '')
44
- str << '<c:' << tag_name.to_s << '>'
45
- @data.to_xml_string str
46
- str << '</c:' << tag_name.to_s << '>'
47
- end
48
-
49
- end
50
-
51
- end
File without changes
@@ -1,64 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
- # a hlinkClick object adds a click behaviour to a drawing object.
4
- # using the hlink_click method on a drawing object is the recommended way to manage hlinks
5
- # @see Pic#link_to
6
- class Hyperlink
7
-
8
- # the type of hyper link defines the onclick or mouseover trigger.
9
- # type must be one of :hlinkClick or :hlinkMouse
10
- def type
11
- @type ||= :hlinkClick
12
- end
13
-
14
- # sets the type of the object.
15
- # @param [Symbol] type one of :hlinkClick or hlinkMouse
16
- def type(v) RestrictionValidator.validate "Hyperlink.type", [:hlinkClick, :hlinkMouse], v; @type = v end
17
-
18
- # The destination of the hyperlink
19
- # This value is actually stored in the drawings .rels. doc as a relationship.
20
- attr_accessor :href
21
-
22
- # The docs say:
23
- # Specifies the URL when it has been determined by the generating application that the URL is invalid. That is the generating application can still store the URL but it is known that this URL is not correct.
24
- attr_accessor :invalidUrl
25
-
26
- # Specifies the target frame that is to be used when opening this hyperlink. When the hyperlink is activated this attribute is used to determine if a new window is launched for viewing or if an existing one can be used. If this attribute is omitted, than a new window is opened.
27
- attr_accessor :tgtFrame
28
-
29
- # Specifies the tooltip that should be displayed when the hyperlink text is hovered over with the mouse. If this attribute is omitted, than the hyperlink text itself can be displayed.
30
- attr_accessor :tooltip
31
-
32
- #Creates a hyperlink object
33
- # parent must be a Pic for now, although I expect that other object support this tag and its cNvPr parent
34
- # @param [Pic] parent
35
- # @option [String] tooltip message shown when hyperlinked object is hovered over with mouse.
36
- # @option [String] tgtFrame Target frame for opening hyperlink
37
- # @option [String] invalidUrl supposedly use to store the href when we know it is an invalid resource.
38
- # @option [String] href the target resource this hyperlink links to.
39
- def initialize(parent, options=>{})
40
- DataTypeValidator.validate "Hyperlink.parent", [Pic], parent
41
- @parent = parent
42
- options.each do |o|
43
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
44
- end
45
- end
46
-
47
- # The index of this hyperlink in the owning document's hyperlinks collection
48
- # @returns [Integer]
49
- def index
50
- self.parent.anchor.drawing.hyperlinks.index(self)
51
- end
52
-
53
- # The relational ID for this hyperlink
54
- # @returns [String]
55
- def r:id
56
- reference_count = self.parent.anchor.drawing.charts.size + self.parent.anchor.drawing.images.size + index
57
-
58
- end
59
-
60
- def to_xml(xml)
61
- xml.send(type,
62
- end
63
- end
64
- end
@@ -1,51 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
-
4
- #This class specifies data for a particular data point. It is used for both numCache and numLit object
5
- class NumData < StrData
6
-
7
- def self.allowed_tag_names
8
- [:numCache, :numLit]
9
- end
10
-
11
- # A string representing the format code to apply. For more information see see the SpreadsheetML numFmt element's (§18.8.30) formatCode attribute.
12
- # @return [String]
13
- attr_reader :format_code
14
-
15
- # creates a new NumVal object
16
- # @option options [String] formatCode
17
- # @option options [Array] :data
18
- # @option options [Array] :data
19
- # @option options [String] :tag_name
20
- # @see StrData
21
- def initialize(options={})
22
- @tag_prefix = :num
23
- @type = NumVal
24
- @format_code = "General"
25
- @pt = SimpleTypedList.new @type
26
- options.each do |o|
27
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
28
- end
29
-
30
- end
31
-
32
- # @see format_code
33
- def format_code=(v='General')
34
- Axlsx::validate_string(v)
35
- @format_code = v
36
- end
37
-
38
- # serialize the object
39
- def to_xml_string(idx, str = "")
40
- str << '<c:' << tag_name.to_s << '>'
41
- str << '<c:formatCode>' << format_code.to_s << '</c:formatCode>'
42
- str << '<c:ptCount val="' << @pt.size.to_s << '"/>'
43
- pt.each_with_index do |num_val, index|
44
- num_val.to_xml_string index, str
45
- end
46
- str << '</c:' << tag_name.to_s << '>'
47
- end
48
-
49
- end
50
-
51
- end
@@ -1,54 +0,0 @@
1
- module Axlsx
2
- # A numeric data source for use by charts.
3
- class NumDataSource
4
-
5
- # The tag name to use when serializing this data source.
6
- # Only items defined in allowed_tag_names are allowed
7
- # @return [Symbol]
8
- attr_reader :tag_name
9
-
10
- attr_reader :data
11
-
12
- # allowed element tag names
13
- # @return [Array]
14
- def self.allowed_tag_names
15
- [:yVal, :val]
16
- end
17
-
18
- # creates a new NumDataSource object
19
- # @option options [Array] data An array of Cells or Numeric objects
20
- # @option options [Symbol] tag_name see tag_name
21
- def initialize(options={})
22
- @f = nil
23
- @tag_name = :val
24
- @data = NumData.new(options)
25
- if options[:data] && options[:data].first.is_a?(Cell)
26
- @f = Axlsx::cell_range(options[:data])
27
- end
28
- options.each do |o|
29
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
30
- end
31
- end
32
-
33
- # sets the tag name for this data source
34
- # @param [Symbol] One of the allowed_tag_names
35
- def tag_name=(v)
36
- Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v
37
- @tag_name = v
38
- end
39
-
40
- def to_xml_string(str="")
41
- str << '<c:' << tag_name.to_s << '>'
42
- if @f
43
- str << '<c:numRef>'
44
- str << '<c:f>' << @f.to_s << '</c:f>'
45
- end
46
- @data.to_xml_string str
47
- if @f
48
- str << '</c:numRef>'
49
- end
50
- str << '</c:' << tag_name.to_s << '>'
51
- end
52
- end
53
- end
54
-
@@ -1,40 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
-
4
- #This class specifies data for a particular data point.
5
- class NumVal < StrVal
6
-
7
- # A string representing the format code to apply. For more information see see the SpreadsheetML numFmt element's (§18.8.30) formatCode attribute.
8
- # @return [String]
9
- attr_reader :format_code
10
-
11
- # creates a new NumVal object
12
- # @option options [String] formatCode
13
- # @option options [Integer] v
14
- def initialize(options={})
15
- @format_code = "General"
16
- @v = @idx = 0
17
- options.each do |o|
18
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
19
- end
20
- end
21
-
22
- # @see format_code
23
- def format_code=(v='General')
24
- Axlsx::validate_string(v)
25
- @format_code = v
26
- end
27
-
28
- # @see v
29
- def v=(v)
30
- Axlsx::validate_int(v)
31
- @v = v
32
- end
33
-
34
- # serialize the object
35
- def to_xml_string(idx, str = "")
36
- Axlsx::validate_unsigned_int(idx)
37
- str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>'
38
- end
39
- end
40
- end
@@ -1,36 +0,0 @@
1
- module Axlsx
2
- # The picture locking class defines the locking properties for pictures in your workbook.
3
- class PictureLocking
4
-
5
-
6
- attr_reader :noGrp
7
- attr_reader :noSelect
8
- attr_reader :noRot
9
- attr_reader :noChangeAspect
10
- attr_reader :noMove
11
- attr_reader :noResize
12
- attr_reader :noEditPoints
13
- attr_reader :noAdjustHandles
14
- attr_reader :noChangeArrowheads
15
- attr_reader :noChangeShapeType
16
-
17
- # Creates a new PictureLocking object
18
- # @option options [Boolean] noGrp
19
- # @option options [Boolean] noSelect
20
- # @option options [Boolean] noRot
21
- # @option options [Boolean] noChangeAspect
22
- # @option options [Boolean] noMove
23
- # @option options [Boolean] noResize
24
- # @option options [Boolean] noEditPoints
25
- # @option options [Boolean] noAdjustHandles
26
- # @option options [Boolean] noChangeArrowheads
27
- # @option options [Boolean] noChangeShapeType
28
- def initialize(options={})
29
- options.each do |o|
30
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
31
- end
32
- end
33
-
34
-
35
- end
36
- end
@@ -1,41 +0,0 @@
1
- module Axlsx
2
-
3
- # Base class for xVal, yVal and val data sources
4
- class DataSource
5
-
6
- def self.allowed_tag_names
7
- [:yVal, :xVal, :val]
8
- end
9
-
10
- def self.allowed_types
11
- [NumData, StrData]
12
- end
13
-
14
- attr_reader :tag_name
15
-
16
- attr_reader :data
17
-
18
- def initialize(type, data=[])
19
- Axlsx::RestrictionValidator.validate "#{self.class.name}", self.class.allowed_types, type
20
- @data = type.new
21
- end
22
-
23
- def f
24
-
25
- end
26
-
27
- def is_literal?
28
-
29
- end
30
-
31
- def is_reference?
32
-
33
- end
34
-
35
- def to_xml_string(str = '')
36
-
37
- end
38
-
39
- end
40
-
41
- end
@@ -1,58 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
-
4
- #This specifies the last string data used for a chart. (e.g. strLit and strCache)
5
- # This class is extended for NumData to include the formatCode attribute required for numLit and numCache
6
- class StrData
7
-
8
- def self.allowed_tag_names
9
- [:strCache, :strLit]
10
- end
11
-
12
- # A list of NumVal objects
13
- # @return [SimpleTypedList]
14
- attr_reader :pt
15
-
16
- # The tag name to use when serializing this object.
17
- # this is restricted to the values returnd by self.allowed_tag_names
18
- attr_reader :tag_name
19
-
20
- # creates a new StrVal object
21
- # @option options [Array] :data
22
- # @option options [String] :tag_name
23
- def initialize(options={})
24
- @tag_prefix = :str
25
- @type = StrVal
26
- @pt = SimpleTypedList.new(@type)
27
- options.each do |o|
28
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
29
- end
30
- end
31
-
32
- def data=(values)
33
- # raise ArgumentError, 'data assignation must be done with an array' unless values.is_a?(Array)
34
- @tag_name = values.first.is_a?(Cell) ? "#{@tag_prefix.to_s}Cache".to_sym : "#{@tag_prefix.to_s}Lit".to_sym
35
- values.each do |value|
36
- v = value.is_a?(Cell)? v.value : value
37
- @pt << @type.new(:v => v)
38
- end
39
- end
40
-
41
- def tag_name=(v)
42
- Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v
43
- @tag_name = v
44
- end
45
-
46
- # serialize the object
47
- def to_xml_string(idx, str = "")
48
- str << '<c:' << tag_name.to_s << '>'
49
- str << '<c:ptCount val="' << @pt.size.to_s << '"/>'
50
- pt.each_with_index do |value, index|
51
- value.to_xml_string index, str
52
- end
53
- str << '</c:' << tag_name.to_s << '>'
54
- end
55
-
56
- end
57
-
58
- end
@@ -1,35 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
-
4
- #This class specifies data for a particular data point.
5
- class StrVal
6
-
7
- # a string value.
8
- # @return [String]
9
- attr_reader :v
10
-
11
- # creates a new StrVal object
12
- # @option options [String] v
13
- def initialize(options={})
14
- @v = ""
15
- @idx = 0
16
- options.each do |o|
17
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
18
- end
19
-
20
- end
21
- # @see v
22
- def v=(v)
23
- Axlsx::validate_string(v)
24
- @v = v
25
- end
26
-
27
- # serialize the object
28
- def to_xml_string(idx, str = "")
29
- Axlsx::validate_unsigned_int(idx)
30
- str << '<c:pt idx="' << idx.to_s << '"><c:v>' << v.to_s << '</c:v></c:pt>'
31
- end
32
-
33
- end
34
-
35
- end
@@ -1,6 +0,0 @@
1
- module Axlsx
2
-
3
-
4
- class VmlDrawing
5
- end
6
- end
@@ -1,61 +0,0 @@
1
- module Axlsx
2
- class VmlShape
3
-
4
- attr_reader :row
5
-
6
- attr_reader :column
7
-
8
- attr_reader :left_column
9
- attr_reader :left_offset
10
- attr_reader :top_row
11
- attr_reader :top_offset
12
- attr_reader :right_column
13
- attr_reader :right_offset
14
- attr_reader :bottom_row
15
- attr_reader :bottom_offset
16
-
17
- def initialize(comment, options={})
18
- @row = @column = 0
19
- @left_column = 0
20
- @left_offset = 15
21
- @top_row = 0
22
- @top_offset = 2
23
- @right_column = 0
24
- @right_offset = 50
25
- @bottom_row = 0
26
- @bottom_offset = 5
27
- options.each do |o|
28
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
29
- end
30
-
31
-
32
- end
33
-
34
- def xml_to_string(str ='') str << <<SHAME_ON_YOU
35
-
36
- <v:shape id="_x0000_s#{@comments.worksheet.index+1}07#{index+1}" type="#_x0000_t202"
37
- style='position:absolute;margin-left:104pt;margin-top:2pt;width:800px;height:27pt;z-index:1;mso-wrap-style:tight'
38
- fillcolor="#ffffa1 [80]" o:insetmode="auto">
39
- <v:fill color2="#ffffa1 [80]"/>
40
- <v:shadow on="t" obscured="t"/>
41
- <v:path o:connecttype="none"/>
42
- <v:textbox style='mso-fit-text-with-word-wrap:t'>
43
- <div style='text-align:left'></div>
44
- </v:textbox>
45
-
46
- <x:ClientData ObjectType="Note">
47
- <x:MoveWithCells/>
48
- <x:SizeWithCells/>
49
- # LeftColumn, LeftOffset, TopRow, TopOffset, RightColumn, RightOffset, BottomRow, BottomOffset.
50
- <x:Anchor>#{comment.comments.worksheet[comment.ref].index + 1}, 15, #{comment.comments.worksheet[comment.ref].row.index}, 2, #{comment.comments.worksheet[comment.ref].index + 5}, 50, #{comment.comments.worksheet[comment.ref].row.index + 5}, 5</x:Anchor>
51
- <x:AutoFill>False</x:AutoFill>
52
- <x:Row>#{comment.comments.worksheet[comment.ref].row.index}</x:Row>
53
- <x:Column>#{comment.comments.worksheet[comment.ref].index}</x:Column>
54
- <x:Visible/>
55
- </x:ClientData>
56
- </v:shape>
57
- SHAME_ON_YOU
58
-
59
- end
60
- end
61
- end