From aa11b0c7de15b286246e943a7d2fb962e12bde83 Mon Sep 17 00:00:00 2001 From: Erik Veijola Date: Tue, 28 Jul 2015 11:38:45 +0300 Subject: title.rb: added text_size to set the font size of the title Signed-off-by: Erik Veijola --- lib/axlsx/drawing/title.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb index 4e278689..7f2ff9f4 100644 --- a/lib/axlsx/drawing/title.rb +++ b/lib/axlsx/drawing/title.rb @@ -7,15 +7,24 @@ module Axlsx # @return [String] attr_reader :text + # Text size property + # @return [String] + attr_reader :text_size + # The cell that holds the text for the title. Setting this property will automatically update the text attribute. # @return [Cell] attr_reader :cell # Creates a new Title object # @param [String, Cell] title The cell or string to be used for the chart's title - def initialize(title="") + def initialize(title="", title_size="") self.cell = title if title.is_a?(Cell) self.text = title.to_s unless title.is_a?(Cell) + if title_size.to_s.empty? + self.text_size = "1600" + else + self.text_size = title_size.to_s + end end # @see text @@ -26,6 +35,14 @@ module Axlsx v end + # @see text_size + def text_size=(v) + DataTypeValidator.validate 'Title.text_size', String, v + @text_size = v + @cell = nil + v + end + # @see cell def cell=(v) DataTypeValidator.validate 'Title.text', Cell, v @@ -62,6 +79,7 @@ module Axlsx str << '' str << '' str << '' + str << ('') str << ('' << @text.to_s << '') str << '' str << '' -- cgit v1.2.3