summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/title.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-06-05 13:03:32 +0900
committerRandy Morgan <[email protected]>2012-06-05 13:03:32 +0900
commit2d6d18c2e0b8e1b68adae27500c002cfb4cd01b4 (patch)
tree32fc2c25a21bba50f10d610cdeb157dd04276793 /lib/axlsx/drawing/title.rb
parent705b92c0764452cfa8a2b8e4130cadb0bd83e798 (diff)
downloadcaxlsx-2d6d18c2e0b8e1b68adae27500c002cfb4cd01b4.tar.gz
caxlsx-2d6d18c2e0b8e1b68adae27500c002cfb4cd01b4.zip
fix chart title parsing to properly handle non-cell based text runs
Diffstat (limited to 'lib/axlsx/drawing/title.rb')
-rw-r--r--lib/axlsx/drawing/title.rb30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb
index a85d8e11..5292a177 100644
--- a/lib/axlsx/drawing/title.rb
+++ b/lib/axlsx/drawing/title.rb
@@ -46,15 +46,27 @@ module Axlsx
str << '<c:title>'
unless @text.empty?
str << '<c:tx>'
- str << '<c:strRef>'
- str << '<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>'
- str << '<c:strCache>'
- str << '<c:ptCount val="1"/>'
- str << '<c:pt idx="0">'
- str << '<c:v>' << @text << '</c:v>'
- str << '</c:pt>'
- str << '</c:strCache>'
- str << '</c:strRef>'
+ if @cell.is_a?(Cell)
+ str << '<c:strRef>'
+ str << '<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>'
+ str << '<c:strCache>'
+ str << '<c:ptCount val="1"/>'
+ str << '<c:pt idx="0">'
+ str << '<c:v>' << @text << '</c:v>'
+ str << '</c:pt>'
+ str << '</c:strCache>'
+ str << '</c:strRef>'
+ else
+ str << '<c:rich>'
+ str << '<a:bodyPr/>'
+ str << '<a:lstStyle/>'
+ str << '<a:p>'
+ str << '<a:r>'
+ str << '<a:t>' << @text.to_s << '</a:t>'
+ str << '</a:r>'
+ str << '</a:p>'
+ str << '</c:rich>'
+ end
str << '</c:tx>'
end
str << '<c:layout/>'