axlsx 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/README.md +41 -5
  2. data/Rakefile +3 -2
  3. data/examples/chart_colors.rb +18 -3
  4. data/examples/example.rb +100 -46
  5. data/examples/extractive.pdf +0 -0
  6. data/lib/axlsx.rb +7 -6
  7. data/lib/axlsx/content_type/content_type.rb +2 -0
  8. data/lib/axlsx/content_type/default.rb +21 -12
  9. data/lib/axlsx/content_type/override.rb +22 -11
  10. data/lib/axlsx/doc_props/app.rb +36 -32
  11. data/lib/axlsx/doc_props/core.rb +9 -5
  12. data/lib/axlsx/drawing/ax_data_source.rb +7 -6
  13. data/lib/axlsx/drawing/axis.rb +48 -27
  14. data/lib/axlsx/drawing/bar_3D_chart.rb +47 -37
  15. data/lib/axlsx/drawing/bar_series.rb +1 -0
  16. data/lib/axlsx/drawing/cat_axis.rb +42 -38
  17. data/lib/axlsx/drawing/chart.rb +34 -27
  18. data/lib/axlsx/drawing/drawing.rb +5 -4
  19. data/lib/axlsx/drawing/line_3D_chart.rb +1 -1
  20. data/lib/axlsx/drawing/num_data_source.rb +1 -1
  21. data/lib/axlsx/drawing/pie_3D_chart.rb +7 -7
  22. data/lib/axlsx/drawing/two_cell_anchor.rb +3 -8
  23. data/lib/axlsx/drawing/view_3D.rb +41 -31
  24. data/lib/axlsx/drawing/vml_drawing.rb +1 -1
  25. data/lib/axlsx/package.rb +11 -11
  26. data/lib/axlsx/rels/relationship.rb +3 -3
  27. data/lib/axlsx/stylesheet/styles.rb +1 -1
  28. data/lib/axlsx/util/constants.rb +4 -0
  29. data/lib/axlsx/util/simple_typed_list.rb +2 -2
  30. data/lib/axlsx/util/validators.rb +2 -2
  31. data/lib/axlsx/version.rb +1 -1
  32. data/lib/axlsx/workbook/workbook.rb +1 -2
  33. data/lib/axlsx/workbook/worksheet/cell.rb +1 -1
  34. data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
  35. data/lib/axlsx/workbook/worksheet/page_setup.rb +9 -0
  36. data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
  37. data/lib/axlsx/workbook/worksheet/worksheet.rb +180 -56
  38. data/test/content_type/tc_content_type.rb +1 -6
  39. data/test/doc_props/tc_core.rb +1 -1
  40. data/test/drawing/tc_axis.rb +8 -0
  41. data/test/drawing/tc_bar_3D_chart.rb +12 -12
  42. data/test/drawing/tc_bar_series.rb +0 -1
  43. data/test/drawing/tc_chart.rb +1 -5
  44. data/test/drawing/tc_pie_3D_chart.rb +3 -7
  45. data/test/drawing/tc_view_3D.rb +18 -18
  46. data/test/tc_package.rb +2 -0
  47. data/test/workbook/worksheet/tc_page_setup.rb +20 -3
  48. data/test/workbook/worksheet/tc_protected_range.rb +18 -0
  49. data/test/workbook/worksheet/tc_selection.rb +1 -1
  50. data/test/workbook/worksheet/tc_worksheet.rb +39 -18
  51. metadata +54 -103
  52. data/examples/axis-titles.xlsx +0 -0
  53. data/examples/basic_charts.xlsx +0 -0
  54. data/examples/chart_colors.xlsx +0 -0
  55. data/examples/charts.xlsx +0 -0
  56. data/examples/conditional_formatting/getting_barred.xlsx +0 -0
  57. data/examples/doc/_index.html +0 -84
  58. data/examples/doc/class_list.html +0 -47
  59. data/examples/doc/css/common.css +0 -1
  60. data/examples/doc/css/full_list.css +0 -55
  61. data/examples/doc/css/style.css +0 -322
  62. data/examples/doc/file_list.html +0 -46
  63. data/examples/doc/frames.html +0 -13
  64. data/examples/doc/index.html +0 -84
  65. data/examples/doc/js/app.js +0 -205
  66. data/examples/doc/js/full_list.js +0 -173
  67. data/examples/doc/js/jquery.js +0 -16
  68. data/examples/doc/method_list.html +0 -46
  69. data/examples/doc/top-level-namespace.html +0 -95
  70. data/examples/example.xlsx +0 -0
  71. data/examples/example_streamed.xlsx +0 -0
  72. data/examples/examples_saved.xlsx +0 -0
  73. data/examples/extractive.xlsx +0 -0
  74. data/examples/fish.xlsx +0 -0
  75. data/examples/no-use_autowidth.xlsx +0 -0
  76. data/examples/pareto.rb +0 -28
  77. data/examples/pareto.xlsx +0 -0
  78. data/examples/pie_chart_excel.xlsx +0 -0
  79. data/examples/pie_chart_saved.xlsx +0 -0
  80. data/examples/shared_strings_example.xlsx +0 -0
  81. data/examples/sheet_protection.xlsx +0 -0
  82. data/examples/sheet_view.xlsx +0 -0
  83. data/examples/two_cell_anchor_image.xlsx +0 -0
  84. data/examples/~$example.xlsx +0 -0
  85. data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
  86. data/lib/axlsx/drawing/data_source.rb~ +0 -51
  87. data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
  88. data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
  89. data/lib/axlsx/drawing/num_data.rb~ +0 -51
  90. data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
  91. data/lib/axlsx/drawing/num_val.rb~ +0 -40
  92. data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
  93. data/lib/axlsx/drawing/ref.rb~ +0 -41
  94. data/lib/axlsx/drawing/str_data.rb~ +0 -58
  95. data/lib/axlsx/drawing/str_val.rb~ +0 -35
  96. data/lib/axlsx/drawing/vml_drawing.rb~ +0 -6
  97. data/lib/axlsx/drawing/vml_shape.rb~ +0 -61
  98. data/lib/axlsx/util/cbf.rb +0 -333
  99. data/lib/axlsx/util/cfb.rb~ +0 -201
  100. data/lib/axlsx/util/font_tables.rb~ +0 -0
  101. data/lib/axlsx/util/ms_off_crypto.rb +0 -189
  102. data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
  103. data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
  104. data/lib/axlsx/util/parser.rb~ +0 -6
  105. data/lib/axlsx/util/storage.rb~ +0 -0
  106. data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
  107. data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
  108. data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
  109. data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
  110. data/lib/axlsx/workbook/worksheet/comment.rb~ +0 -91
  111. data/lib/axlsx/workbook/worksheet/comments.rb~ +0 -86
  112. data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
  113. data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
  114. data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
  115. data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
  116. data/lib/schema/dc.xsd~ +0 -118
  117. data/lib/schema/dcterms.xsd~ +0 -331
  118. data/lib/schema/opc-coreProperties.xsd~ +0 -50
  119. data/test/drawing/tc_data_source.rb~ +0 -30
  120. data/test/drawing/tc_num_data.rb~ +0 -35
  121. data/test/drawing/tc_num_val.rb~ +0 -29
  122. data/test/drawing/tc_str_data.rb~ +0 -30
  123. data/test/drawing/tc_str_val.rb~ +0 -26
  124. data/test/drawing/tc_vml_drawing.rb~ +0 -0
  125. data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
  126. data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
  127. data/test/workbook/worksheet/tc_col.rb~ +0 -10
  128. data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
  129. data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
  130. data/test/workbook/worksheet/tc_icon_set.rb~ +0 -0
@@ -64,6 +64,7 @@ module Axlsx
64
64
 
65
65
  @labels.to_xml_string(str_inner) unless @labels.nil?
66
66
  @data.to_xml_string(str_inner) unless @data.nil?
67
+ # this is actually only required for shapes other than box
67
68
  str_inner << '<c:shape val="' << shape.to_s << '"></c:shape>'
68
69
  end
69
70
  end
@@ -3,6 +3,26 @@ module Axlsx
3
3
  #A CatAxis object defines a chart category axis
4
4
  class CatAxis < Axis
5
5
 
6
+ # Creates a new CatAxis object
7
+ # @param [Integer] ax_id the id of this axis. Inherited
8
+ # @param [Integer] cross_ax the id of the perpendicular axis. Inherited
9
+ # @option options [Symbol] ax_pos. Inherited
10
+ # @option options [Symbol] tick_lbl_pos. Inherited
11
+ # @option options [Symbol] crosses. Inherited
12
+ # @option options [Boolean] auto
13
+ # @option options [Symbol] lbl_algn
14
+ # @option options [Integer] lbl_offset
15
+ # @option options [Integer] tick_lbl_skip
16
+ # @option options [Integer] tick_mark_skip
17
+ def initialize(ax_id, cross_ax, options={})
18
+ @tick_lbl_skip = 1
19
+ @tick_mark_skip = 1
20
+ self.auto = 1
21
+ self.lbl_algn = :ctr
22
+ self.lbl_offset = "100"
23
+ super(ax_id, cross_ax, options)
24
+ end
25
+
6
26
  # From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
7
27
  # @return [Boolean]
8
28
  attr_reader :auto
@@ -10,64 +30,48 @@ module Axlsx
10
30
  # specifies how the perpendicular axis is crossed
11
31
  # must be one of [:ctr, :l, :r]
12
32
  # @return [Symbol]
13
- attr_reader :lblAlgn
33
+ attr_reader :lbl_algn
34
+ alias :lblAlgn :lbl_algn
14
35
 
15
36
  # The offset of the labels
16
37
  # must be between a string between 0 and 1000
17
38
  # @return [Integer]
18
- attr_reader :lblOffset
19
-
39
+ attr_reader :lbl_offset
40
+ alias :lblOffset :lbl_offset
20
41
 
21
42
  # The number of tick lables to skip between labels
22
43
  # @return [Integer]
23
- attr_reader :tickLblSkip
44
+ attr_reader :tick_lbl_skip
45
+ alias :tickLblSkip :tick_lbl_skip
24
46
 
25
47
  # The number of tickmarks to be skipped before the next one is rendered.
26
48
  # @return [Boolean]
27
- attr_reader :tickMarkSkip
28
-
49
+ attr_reader :tick_mark_skip
50
+ alias :tickMarkSkip :tick_mark_skip
29
51
 
30
52
  # regex for validating label offset
31
53
  LBL_OFFSET_REGEX = /0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)/
32
54
 
33
- # Creates a new CatAxis object
34
- # @param [Integer] axId the id of this axis. Inherited
35
- # @param [Integer] crossAx the id of the perpendicular axis. Inherited
36
- # @option options [Symbol] axPos. Inherited
37
- # @option options [Symbol] tickLblPos. Inherited
38
- # @option options [Symbol] crosses. Inherited
39
- # @option options [Boolean] auto
40
- # @option options [Symbol] lblAlgn
41
- # @option options [Integer] lblOffset
42
- # @option options [Integer] tickLblSkip
43
- # @option options [Integer] tickMarkSkip
44
- def initialize(axId, crossAx, options={})
45
- @tickLblSkip = 1
46
- @tickMarkSkip = 1
47
- self.auto = 1
48
- self.lblAlgn = :ctr
49
- self.lblOffset = "100"
50
- super(axId, crossAx, options)
51
- end
52
-
53
-
54
- # @see tickLblSkip
55
- def tickLblSkip=(v) Axlsx::validate_unsigned_int(v); @tickLblSkip = v; end
56
-
57
- # @see tickMarkSkip
58
- def tickMarkSkip=(v) Axlsx::validate_unsigned_int(v); @tickMarkSkip = v; end
55
+ # @see tick_lbl_skip
56
+ def tick_lbl_skip=(v) Axlsx::validate_unsigned_int(v); @tick_lbl_skip = v; end
57
+ alias :tickLblSkip= :tick_lbl_skip=
59
58
 
59
+ # @see tick_mark_skip
60
+ def tick_mark_skip=(v) Axlsx::validate_unsigned_int(v); @tick_mark_skip = v; end
61
+ alias :tickMarkSkip= :tick_mark_skip=
60
62
 
61
63
  # From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
62
64
  def auto=(v) Axlsx::validate_boolean(v); @auto = v; end
63
65
 
64
66
  # specifies how the perpendicular axis is crossed
65
67
  # must be one of [:ctr, :l, :r]
66
- def lblAlgn=(v) RestrictionValidator.validate "#{self.class}.lblAlgn", [:ctr, :l, :r], v; @lblAlgn = v; end
68
+ def lbl_algn=(v) RestrictionValidator.validate "#{self.class}.lbl_algn", [:ctr, :l, :r], v; @lbl_algn = v; end
69
+ alias :lblAlgn= :lbl_algn=
67
70
 
68
71
  # The offset of the labels
69
72
  # must be between a string between 0 and 1000
70
- def lblOffset=(v) RegexValidator.validate "#{self.class}.lblOffset", LBL_OFFSET_REGEX, v; @lblOffset = v; end
73
+ def lbl_offset=(v) RegexValidator.validate "#{self.class}.lbl_offset", LBL_OFFSET_REGEX, v; @lbl_offset = v; end
74
+ alias :lblOffset= :lbl_offset=
71
75
 
72
76
  # Serializes the object
73
77
  # @param [String] str
@@ -76,10 +80,10 @@ module Axlsx
76
80
  str << '<c:catAx>'
77
81
  super(str)
78
82
  str << '<c:auto val="' << @auto.to_s << '"/>'
79
- str << '<c:lblAlgn val="' << @lblAlgn.to_s << '"/>'
80
- str << '<c:lblOffset val="' << @lblOffset.to_i.to_s << '"/>'
81
- str << '<c:tickLblSkip val="' << @tickLblSkip.to_s << '"/>'
82
- str << '<c:tickMarkSkip val="' << @tickMarkSkip.to_s << '"/>'
83
+ str << '<c:lblAlgn val="' << @lbl_algn.to_s << '"/>'
84
+ str << '<c:lblOffset val="' << @lbl_offset.to_i.to_s << '"/>'
85
+ str << '<c:tickLblSkip val="' << @tick_lbl_skip.to_s << '"/>'
86
+ str << '<c:tickMarkSkip val="' << @tick_mark_skip.to_s << '"/>'
83
87
  str << '</c:catAx>'
84
88
  end
85
89
 
@@ -1,13 +1,37 @@
1
1
  # encoding: UTF-8
2
2
  module Axlsx
3
+
3
4
  # A Chart is the superclass for specific charts
4
5
  # @note Worksheet#add_chart is the recommended way to create charts for your worksheets.
5
6
  # @see README for examples
6
7
  class Chart
7
8
 
9
+ # Creates a new chart object
10
+ # @param [GraphicalFrame] frame The frame that holds this chart.
11
+ # @option options [Cell, String] title
12
+ # @option options [Boolean] show_legend
13
+ # @option options [Array|String|Cell] start_at The X, Y coordinates defining the top left corner of the chart.
14
+ # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart.
15
+ def initialize(frame, options={})
16
+ @style = 18
17
+ @view_3D = nil
18
+ @graphic_frame=frame
19
+ @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
20
+ @series = SimpleTypedList.new Series
21
+ @show_legend = true
22
+ @series_type = Series
23
+ @title = Title.new
24
+ options.each do |o|
25
+ self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
26
+ end
27
+ start_at(*options[:start_at]) if options[:start_at]
28
+ end_at(*options[:end_at]) if options[:end_at]
29
+ yield self if block_given?
30
+ end
8
31
 
9
32
  # The 3D view properties for the chart
10
- attr_reader :view3D
33
+ attr_reader :view_3D
34
+ alias :view3D :view_3D
11
35
 
12
36
  # A reference to the graphic frame that owns this chart
13
37
  # @return [GraphicFrame]
@@ -37,29 +61,6 @@ module Axlsx
37
61
  # @return [Boolean]
38
62
  attr_reader :show_legend
39
63
 
40
- # Creates a new chart object
41
- # @param [GraphicalFrame] frame The frame that holds this chart.
42
- # @option options [Cell, String] title
43
- # @option options [Boolean] show_legend
44
- # @option options [Array|String|Cell] start_at The X, Y coordinates defining the top left corner of the chart.
45
- # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart.
46
- def initialize(frame, options={})
47
- @style = 18
48
- @view3D = nil
49
- @graphic_frame=frame
50
- @graphic_frame.anchor.drawing.worksheet.workbook.charts << self
51
- @series = SimpleTypedList.new Series
52
- @show_legend = true
53
- @series_type = Series
54
- @title = Title.new
55
- options.each do |o|
56
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
57
- end
58
- start_at(*options[:start_at]) if options[:start_at]
59
- end_at(*options[:end_at]) if options[:end_at]
60
- yield self if block_given?
61
- end
62
-
63
64
  # The index of this chart in the workbooks charts collection
64
65
  # @return [Integer]
65
66
  def index
@@ -89,7 +90,6 @@ module Axlsx
89
90
  # @return [Boolean]
90
91
  def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end
91
92
 
92
-
93
93
  # The style for the chart.
94
94
  # see ECMA Part 1 §21.2.2.196
95
95
  # @param [Integer] v must be between 1 and 48
@@ -127,7 +127,7 @@ module Axlsx
127
127
  @title.to_xml_string str
128
128
  # do these need the c: namespace as well???
129
129
  str << '<c:autoTitleDeleted val="' << (@title == nil).to_s << '"/>'
130
- @view3D.to_xml_string(str) if @view3D
130
+ @view_3D.to_xml_string(str) if @view_3D
131
131
  str << '<c:floor><c:thickness val="0"/></c:floor>'
132
132
  str << '<c:sideWall><c:thickness val="0"/></c:sideWall>'
133
133
  str << '<c:backWall><c:thickness val="0"/></c:backWall>'
@@ -146,6 +146,11 @@ module Axlsx
146
146
  str << '<c:dispBlanksAs val="zero"/>'
147
147
  str << '<c:showDLblsOverMax val="1"/>'
148
148
  str << '</c:chart>'
149
+ str << '<c:printSettings>'
150
+ str << '<c:headerFooter/>'
151
+ str << '<c:pageMargins b="1.0" l="0.75" r="0.75" t="1.0" header="0.5" footer="0.5"/>'
152
+ str << '<c:pageSetup/>'
153
+ str << '</c:printSettings>'
149
154
  str << '</c:chartSpace>'
150
155
  end
151
156
 
@@ -188,7 +193,9 @@ module Axlsx
188
193
  [x, y]
189
194
  end
190
195
 
191
- def view3D=(v) DataTypeValidator.validate "#{self.class}.view3D", View3D, v; @view3D = v; end
196
+ def view_3D=(v) DataTypeValidator.validate "#{self.class}.view_3D", View3D, v; @view_3D = v; end
197
+ alias :view3D= :view_3D=
192
198
 
193
199
  end
200
+
194
201
  end
@@ -42,12 +42,13 @@ module Axlsx
42
42
  require 'axlsx/drawing/vml_drawing.rb'
43
43
  require 'axlsx/drawing/vml_shape.rb'
44
44
 
45
- # A Drawing is a canvas for charts. Each worksheet has a single drawing that manages anchors.
46
- # The anchors reference the charts via graphical frames. This is not a trivial relationship so please do follow the advice in the note.
47
- # @note The recommended way to manage drawings is to use the Worksheet.add_chart method.
45
+ # A Drawing is a canvas for charts and images. Each worksheet has a single drawing that manages anchors.
46
+ # The anchors reference the charts or images via graphical frames. This is not a trivial relationship so please do follow the advice in the note.
47
+ # @note The recommended way to manage drawings is to use the Worksheet.add_chart and Worksheet.add_image methods.
48
48
  # @see Worksheet#add_chart
49
+ # @see Worksheet#add_image
49
50
  # @see Chart
50
- # see README for an example of how to create a chart.
51
+ # see examples/example.rb for an example of how to create a chart.
51
52
  class Drawing
52
53
 
53
54
  # The worksheet that owns the drawing
@@ -70,7 +70,7 @@ module Axlsx
70
70
  @serAxis = SerAxis.new(@serAxId, @valAxId)
71
71
  super(frame, options)
72
72
  @series_type = LineSeries
73
- @view3D = View3D.new({:perspective=>30}.merge(options))
73
+ @view_3D = View3D.new({:perspective=>30}.merge(options))
74
74
  end
75
75
 
76
76
  # @see grouping
@@ -36,7 +36,7 @@ module Axlsx
36
36
  end
37
37
 
38
38
  # sets the tag name for this data source
39
- # @param [Symbol] One of the allowed_tag_names
39
+ # @param [Symbol] v One of the allowed_tag_names
40
40
  def tag_name=(v)
41
41
  Axlsx::RestrictionValidator.validate "#{self.class.name}.tag_name", self.class.allowed_tag_names, v
42
42
  @tag_name = v
@@ -13,19 +13,19 @@ module Axlsx
13
13
  # @option options [Cell, String] title
14
14
  # @option options [Boolean] show_legend
15
15
  # @option options [Symbol] grouping
16
- # @option options [String] gapDepth
17
- # @option options [Integer] rotX
18
- # @option options [String] hPercent
19
- # @option options [Integer] rotY
20
- # @option options [String] depthPercent
21
- # @option options [Boolean] rAngAx
16
+ # @option options [String] gap_depth
17
+ # @option options [Integer] rot_x
18
+ # @option options [String] h_percent
19
+ # @option options [Integer] rot_y
20
+ # @option options [String] depth_percent
21
+ # @option options [Boolean] r_ang_ax
22
22
  # @option options [Integer] perspective
23
23
  # @see Chart
24
24
  # @see View3D
25
25
  def initialize(frame, options={})
26
26
  super(frame, options)
27
27
  @series_type = PieSeries
28
- @view3D = View3D.new({:rotX=>30, :perspective=>30}.merge(options))
28
+ @view_3D = View3D.new({:rot_x =>30, :perspective=>30}.merge(options))
29
29
  end
30
30
 
31
31
  # Serializes the object
@@ -26,16 +26,11 @@ module Axlsx
26
26
  attr_reader :drawing
27
27
 
28
28
 
29
- # Creates a new TwoCellAnchor object and sets up a reference to the from and to markers in the
30
- # graphic_frame's chart. That means that you can do stuff like
31
- # c = worksheet.add_chart Axlsx::Chart
29
+ # Creates a new TwoCellAnchor object
32
30
  # c.start_at 5, 9
33
- # @note the chart_type parameter will be replaced with object in v. 2.0.0
34
31
  # @param [Drawing] drawing
35
- # @param [Class] chart_type This is passed to the graphic frame for instantiation. must be Chart or a subclass of Chart
36
- # @param object The object this anchor holds.
37
- # @option options [Array] start_at the col, row to start at THIS IS DOCUMENTED BUT NOT IMPLEMENTED HERE!
38
- # @option options [Array] end_at the col, row to end at
32
+ # @option options [Array] :start_at the col, row to start at THIS IS DOCUMENTED BUT NOT IMPLEMENTED HERE!
33
+ # @option options [Array] :end_at the col, row to end at
39
34
  def initialize(drawing, options={})
40
35
  @drawing = drawing
41
36
  drawing.anchors << self
@@ -12,63 +12,73 @@ module Axlsx
12
12
  # x rotation for the chart
13
13
  # must be between -90 and 90
14
14
  # @return [Integer]
15
- attr_reader :rotX
16
-
15
+ attr_reader :rot_x
16
+ alias :rotX :rot_x
17
+
17
18
  # height of chart as % of chart
18
19
  # must be between 5% and 500%
19
20
  # @return [String]
20
- attr_reader :hPercent
21
+ attr_reader :h_percent
22
+ alias :hPercent :h_percent
21
23
 
22
24
  # y rotation for the chart
23
25
  # must be between 0 and 360
24
26
  # @return [Integer]
25
- attr_reader :rotY
26
-
27
+ attr_reader :rot_y
28
+ alias :rotY :rot_y
29
+
27
30
  # depth or chart as % of chart width
28
31
  # must be between 20% and 2000%
29
32
  # @return [String]
30
- attr_reader :depthPercent
33
+ attr_reader :depth_percent
34
+ alias :depthPercent :depth_percent
31
35
 
32
36
  # Chart axis are at right angles
33
37
  # @return [Boolean]
34
- attr_reader :rAngAx
38
+ attr_reader :r_ang_ax
39
+ alias :rAngAx :r_ang_ax
35
40
 
36
41
  # field of view angle
37
42
  # @return [Integer]
38
43
  attr_reader :perspective
39
44
 
40
45
  # Creates a new View3D for charts
41
- # @option options [Integer] rotX
42
- # @option options [String] hPercent
43
- # @option options [Integer] rotY
44
- # @option options [String] depthPercent
45
- # @option options [Boolean] rAngAx
46
+ # @option options [Integer] rot_x
47
+ # @option options [String] h_percent
48
+ # @option options [Integer] rot_y
49
+ # @option options [String] depth_percent
50
+ # @option options [Boolean] r_ang_ax
46
51
  # @option options [Integer] perspective
47
52
  def initialize(options={})
48
- @rotX, @hPercent, @rotY, @depthPercent, @rAngAx, @perspective = nil, nil, nil, nil, nil, nil
53
+ @rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil
49
54
  options.each do |o|
50
55
  self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
51
56
  end
52
57
  end
53
58
 
54
- # @see rotX
55
- def rotX=(v) DataTypeValidator.validate "#{self.class}.rotX", [Integer, Fixnum], v, lambda {|arg| arg >= -90 && arg <= 90 }; @rotX = v; end
59
+ # @see rot_x
60
+ def rot_x=(v) DataTypeValidator.validate "#{self.class}.rot_x", [Integer, Fixnum], v, lambda {|arg| arg >= -90 && arg <= 90 }; @rot_x = v; end
61
+ alias :rotX= :rot_x=
56
62
 
57
- # @see hPercent
58
- def hPercent=(v)
59
- RegexValidator.validate "#{self.class}.hPercent", H_PERCENT_REGEX, v
60
- @hPercent = v
63
+ # @see h_percent
64
+ def h_percent=(v)
65
+ RegexValidator.validate "#{self.class}.h_percent", H_PERCENT_REGEX, v
66
+ @h_percent = v
61
67
  end
68
+ alias :hPercent= :h_percent=
62
69
 
63
- # @see rotY
64
- def rotY=(v) DataTypeValidator.validate "#{self.class}.rotY", [Integer, Fixnum], v, lambda {|arg| arg >= 0 && arg <= 360 }; @rotY = v; end
65
-
66
- # @see depthPercent
67
- def depthPercent=(v) RegexValidator.validate "#{self.class}.depthPercent", DEPTH_PERCENT_REGEX, v; @depthPercent = v; end
70
+ # @see rot_y
71
+ def rot_y=(v) DataTypeValidator.validate "#{self.class}.rot_y", [Integer, Fixnum], v, lambda {|arg| arg >= 0 && arg <= 360 }; @rot_y = v; end
72
+ alias :rotY= :rot_y=
68
73
 
69
- # @see rAngAx
70
- def rAngAx=(v) Axlsx::validate_boolean(v); @rAngAx = v; end
74
+ # @see depth_percent
75
+ def depth_percent=(v) RegexValidator.validate "#{self.class}.depth_percent", DEPTH_PERCENT_REGEX, v; @depth_percent = v; end
76
+ alias :depthPercent= :depth_percent=
71
77
 
78
+ # @see r_ang_ax
79
+ def r_ang_ax=(v) Axlsx::validate_boolean(v); @r_ang_ax = v; end
80
+ alias :rAngAx= :r_ang_ax=
81
+
72
82
  # @see perspective
73
83
  def perspective=(v) DataTypeValidator.validate "#{self.class}.perspective", [Integer, Fixnum], v, lambda {|arg| arg >= 0 && arg <= 240 }; @perspective = v; end
74
84
 
@@ -78,11 +88,11 @@ module Axlsx
78
88
  # @return [String]
79
89
  def to_xml_string(str = '')
80
90
  str << '<c:view3D>'
81
- str << '<c:rotX val="' << @rotX.to_s << '"/>' unless @rotX.nil?
82
- str << '<c:hPercent val="' << @hPercent.to_s << '"/>' unless @hPercent.nil?
83
- str << '<c:rotY val="' << @rotY.to_s << '"/>' unless @rotY.nil?
84
- str << '<c:depthPercent val="' << @depthPercent.to_s << '"/>' unless @depthPercent.nil?
85
- str << '<c:rAngAx val="' << @rAngAx.to_s << '"/>' unless @rAngAx.nil?
91
+ str << '<c:rotX val="' << @rot_x.to_s << '"/>' unless @rot_x.nil?
92
+ str << '<c:hPercent val="' << @h_percent.to_s << '"/>' unless @h_percent.nil?
93
+ str << '<c:rotY val="' << @rot_y.to_s << '"/>' unless @rot_y.nil?
94
+ str << '<c:depthPercent val="' << @depth_percent.to_s << '"/>' unless @depth_percent.nil?
95
+ str << '<c:rAngAx val="' << @r_ang_ax.to_s << '"/>' unless @r_ang_ax.nil?
86
96
  str << '<c:perspective val="' << @perspective.to_s << '"/>' unless @perspective.nil?
87
97
  str << '</c:view3D>'
88
98
  end
@@ -4,7 +4,7 @@ module Axlsx
4
4
  class VmlDrawing
5
5
 
6
6
  # creates a new Vml Drawing object.
7
- # @param [Comments] the comments object this drawing is associated with
7
+ # @param [Comments] comments the comments object this drawing is associated with
8
8
  def initialize(comments)
9
9
  raise ArgumentError, "you must provide a comments object" unless comments.is_a?(Comments)
10
10
  @comments = comments