summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/stylesheet/font.rb
diff options
context:
space:
mode:
authorAli Mujtaba <[email protected]>2019-10-15 00:37:56 +0500
committerStefan Daschek <[email protected]>2019-10-29 01:40:55 +0100
commiteaa635a3e4a519556d9e6fe0191afba9aa9125d7 (patch)
tree0dfafe9114b2ed8aebb2819bc87a225e3e57d5c9 /lib/axlsx/stylesheet/font.rb
parent2cdaed0178d95c8f0e63ae60c94cfd8bd787e5c6 (diff)
downloadcaxlsx-eaa635a3e4a519556d9e6fe0191afba9aa9125d7.tar.gz
caxlsx-eaa635a3e4a519556d9e6fe0191afba9aa9125d7.zip
fix validate document with font option underline
Diffstat (limited to 'lib/axlsx/stylesheet/font.rb')
-rw-r--r--lib/axlsx/stylesheet/font.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb
index baa1ef83..d9a4a4d8 100644
--- a/lib/axlsx/stylesheet/font.rb
+++ b/lib/axlsx/stylesheet/font.rb
@@ -76,7 +76,10 @@ module Axlsx
attr_reader :i
# Indicates if the font should be rendered underlined
- # @return [Boolean]
+ # It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting, true, false
+ # @return [String]
+ # @note
+ # true or false is for backwards compatibility and is reassigned to :single or :none respectively
attr_reader :u
# Indicates if the font should be rendered with a strikthrough
@@ -118,7 +121,12 @@ module Axlsx
# @see i
def i=(v) Axlsx::validate_boolean v; @i = v end
# @see u
- def u=(v) Axlsx::validate_boolean v; @u = v end
+ def u=(v)
+ v = :single if (v == true || v == 1 || v == :true || v == 'true')
+ v = :none if (v == false || v == 0 || v == :false || v == 'false')
+ Axlsx::validate_cell_u v
+ @u = v
+ end
# @see strike
def strike=(v) Axlsx::validate_boolean v; @strike = v end
# @see outline