class Axlsx::VmlShape

A VmlShape is used to position and render a comment.

Public Class Methods

new(options={}) { |self| ... } click to toggle source

Creates a new VmlShape @option options [Integer] row @option options [Integer] column @option options [Integer] left_column @option options [Integer] left_offset @option options [Integer] top_row @option options [Integer] top_offset @option options [Integer] right_column @option options [Integer] right_offset @option options [Integer] bottom_row @option options [Integer] bottom_offset

# File lib/axlsx/drawing/vml_shape.rb, line 20
def initialize(options={})
  @row = @column = @left_column = @top_row = @right_column = @bottom_row = 0
  @left_offset = 15
  @top_offset = 2
  @right_offset = 50
  @bottom_offset = 5
  @visible = true
  @id = (0...8).map{65.+(rand(25)).chr}.join
  parse_options options
  yield self if block_given?
end

Public Instance Methods

to_xml_string(str ='') click to toggle source

serialize the shape to a string @param [String] str @return [String]

# File lib/axlsx/drawing/vml_shape.rb, line 40
    def to_xml_string(str ='')
str << <<SHAME_ON_YOU

<v:shape id="#{@id}" type="#_x0000_t202" fillcolor="#ffffa1 [80]" o:insetmode="auto"
  style="visibility:#{@visible ? 'visible' : 'hidden'}">
  <v:fill color2="#ffffa1 [80]"/>
  <v:shadow on="t" obscured="t"/>
  <v:path o:connecttype="none"/>
  <v:textbox style='mso-fit-text-with-word-wrap:t'>
   <div style='text-align:left'></div>
  </v:textbox>

  <x:ClientData ObjectType="Note">
   <x:MoveWithCells/>
   <x:SizeWithCells/>
   <x:Anchor>#{left_column}, #{left_offset}, #{top_row}, #{top_offset}, #{right_column}, #{right_offset}, #{bottom_row}, #{bottom_offset}</x:Anchor>
   <x:AutoFill>False</x:AutoFill>
   <x:Row>#{row}</x:Row>
   <x:Column>#{column}</x:Column>
   #{@visible ? '<x:Visible/>' : ''}
  </x:ClientData>
 </v:shape>
SHAME_ON_YOU

    end