class Axlsx::VmlDrawing
a vml drawing used for comments in excel.
Public Class Methods
new(comments)
click to toggle source
creates a new Vml Drawing
object. @param [Comments] comments the comments object this drawing is associated with
# File lib/axlsx/drawing/vml_drawing.rb, line 8 def initialize(comments) raise ArgumentError, "you must provide a comments object" unless comments.is_a?(Comments) @comments = comments end
Public Instance Methods
pn()
click to toggle source
The part name for this vml drawing @return [String]
# File lib/axlsx/drawing/vml_drawing.rb, line 15 def pn "#{VML_DRAWING_PN}" % (@comments.worksheet.index + 1) end
to_xml_string(str = '')
click to toggle source
serialize the vml_drawing to xml. @param [String] str @return [String]
# File lib/axlsx/drawing/vml_drawing.rb, line 22 def to_xml_string(str = '') str = <<BAD_PROGRAMMER <xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="#{@comments.worksheet.index+1}"/> </o:shapelayout> <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m0,0l0,21600,21600,21600,21600,0xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype> BAD_PROGRAMMER @comments.each { |comment| comment.vml_shape.to_xml_string str } str << "</xml>" end