summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/axis.rb
diff options
context:
space:
mode:
authorChris Roby <[email protected]>2013-01-16 15:50:00 -0800
committerChris Roby <[email protected]>2014-03-04 10:56:15 -0800
commit1f2795ac1c840d2bbb5435abd22e31abcf7fbc4e (patch)
tree3fd4d94b010d3454f76f3bd8d8e35d2f8059a50c /lib/axlsx/drawing/axis.rb
parent39b700add2fd0920a61f6951a6466f15da355edb (diff)
downloadcaxlsx-1f2795ac1c840d2bbb5435abd22e31abcf7fbc4e.tar.gz
caxlsx-1f2795ac1c840d2bbb5435abd22e31abcf7fbc4e.zip
sourceLinked should be false (0) when specifying a format_code for an axis
Diffstat (limited to 'lib/axlsx/drawing/axis.rb')
-rw-r--r--lib/axlsx/drawing/axis.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb
index 7e677a2e..b2bb8fe7 100644
--- a/lib/axlsx/drawing/axis.rb
+++ b/lib/axlsx/drawing/axis.rb
@@ -165,7 +165,10 @@ module Axlsx
end
str << '</c:majorGridlines>'
@title.to_xml_string(str) unless @title == nil
- str << ('<c:numFmt formatCode="' << @format_code << '" sourceLinked="1"/>')
+ # Need to set sourceLinked to 0 if we're setting a format code on this row
+ # otherwise it will never take, as it will always prefer the 'General' formatting
+ # of the cells themselves
+ str << ('<c:numFmt formatCode="' << @format_code << '" sourceLinked="' << (@format_code.eql?('General') ? '1' : '0') << '"/>')
str << '<c:majorTickMark val="none"/>'
str << '<c:minorTickMark val="none"/>'
str << ('<c:tickLblPos val="' << @tick_lbl_pos.to_s << '"/>')