Sha256: ed6e2bd90760879cb1acab5d7741fec1300af4114955d77ebd3bf884b51a9688

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module DocxGenerator
  module Word
    class Bold < Element
      def initialize(present = nil)
        arguments = (present == nil ? {} : { "w:val" => present })
        super("w:b", arguments)
      end
    end
    
    class Italics < Element
      def initialize(present = nil)
        arguments = (present == nil ? {} : { "w:val" => present })
        super("w:i", arguments)
      end
    end

    class Underline < Element
      def initialize(arguments = { "w:val" => "single" })
        final_arguments = {}
        arguments.each do |option, value|
          case option
            when :style then final_arguments["w:val"] = value
            else final_arguments[option] = value
          end
        end
        super("w:u", final_arguments)
      end
    end

    class Size < Element
      # size : The font size in points
      def initialize(size)
        super("w:sz", { "w:val" => size*2 })
      end
    end

    class Alignment < Element
      def initialize(value)
        super("w:jc", { "w:val" => value })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docx_generator-0.0.2 lib/docx_generator/word/formatting.rb