Class: Axlsx::VmlShape
- Inherits:
-
Object
- Object
- Axlsx::VmlShape
- Defined in:
- lib/axlsx/drawing/vml_shape.rb
Overview
A VmlShape is used to position and render a comment.
Instance Attribute Summary collapse
-
#bottom_offset ⇒ Integer
The bottom offset for this shape.
-
#bottom_row ⇒ Integer
The botttom row for this shape.
-
#column ⇒ Integer
The column anchor position for this shape determined by the comment's ref value.
-
#left_column ⇒ Integer
The left column for this shape.
-
#left_offset ⇒ Integer
The left offset for this shape.
-
#right_column ⇒ Integer
The right column for this shape.
-
#right_offset ⇒ Integer
The right offset for this shape.
-
#row ⇒ Integer
The row anchor position for this shape determined by the comment's ref value.
-
#top_offset ⇒ Integer
The top offset for this shape.
-
#top_row ⇒ Integer
The top row for this shape.
Instance Method Summary collapse
-
#initialize(options = {}) {|_self| ... } ⇒ VmlShape
constructor
Creates a new VmlShape.
-
#to_xml_string(str = '') ⇒ String
serialize the shape to a string.
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ VmlShape
Creates a new VmlShape
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 55 def initialize(={}) @row = @column = @left_column = @top_row = @right_column = @bottom_row = 0 @left_offset = 15 @top_offset = 2 @right_offset = 50 @bottom_offset = 5 @id = (0...8).map{65.+(rand(25)).chr}.join .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end yield self if block_given? end |
Instance Attribute Details
#bottom_offset ⇒ Integer
The bottom offset for this shape
44 45 46 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 44 def bottom_offset @bottom_offset end |
#bottom_row ⇒ Integer
The botttom row for this shape
40 41 42 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 40 def bottom_row @bottom_row end |
#column ⇒ Integer
The column anchor position for this shape determined by the comment's ref value
12 13 14 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 12 def column @column end |
#left_column ⇒ Integer
The left column for this shape
16 17 18 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 16 def left_column @left_column end |
#left_offset ⇒ Integer
The left offset for this shape
20 21 22 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 20 def left_offset @left_offset end |
#right_column ⇒ Integer
The right column for this shape
32 33 34 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 32 def right_column @right_column end |
#right_offset ⇒ Integer
The right offset for this shape
36 37 38 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 36 def right_offset @right_offset end |
#row ⇒ Integer
The row anchor position for this shape determined by the comment's ref value
8 9 10 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 8 def row @row end |
#top_offset ⇒ Integer
The top offset for this shape
28 29 30 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 28 def top_offset @top_offset end |
#top_row ⇒ Integer
The top row for this shape
24 25 26 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 24 def top_row @top_row end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
serialize the shape to a string
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/axlsx/drawing/vml_shape.rb', line 100 def to_xml_string(str ='') str << "\n<v:shape id=\"\#{@id}\" type=\"#_x0000_t202\" fillcolor=\"#ffffa1 [80]\" o:insetmode=\"auto\">\n <v:fill color2=\"#ffffa1 [80]\"/>\n <v:shadow on=\"t\" obscured=\"t\"/>\n <v:path o:connecttype=\"none\"/>\n <v:textbox style='mso-fit-text-with-word-wrap:t'>\n <div style='text-align:left'></div>\n </v:textbox>\n\n <x:ClientData ObjectType=\"Note\">\n <x:MoveWithCells/>\n <x:SizeWithCells/>\n <x:Anchor>\#{left_column}, \#{left_offset}, \#{top_row}, \#{top_offset}, \#{right_column}, \#{right_offset}, \#{bottom_row}, \#{bottom_offset}</x:Anchor>\n <x:AutoFill>False</x:AutoFill>\n <x:Row>\#{row}</x:Row>\n <x:Column>\#{column}</x:Column>\n <x:Visible/>\n </x:ClientData>\n </v:shape>\n" end |