summaryrefslogtreecommitdiffstats
path: root/lib/Spreadsheet/ParseXLSX.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-12-09 15:05:26 -0500
committerJesse Luehrs <doy@tozt.net>2013-12-09 15:19:32 -0500
commit176c2e79f2704af024e02d755b3dbb714ba72a70 (patch)
tree55484c21c51415c9600820f0c1f057820ffd44fc /lib/Spreadsheet/ParseXLSX.pm
parentdf3388718f93afb099833d78cdbfdd644ebec594 (diff)
downloadspreadsheet-parsexlsx-176c2e79f2704af024e02d755b3dbb714ba72a70.tar.gz
spreadsheet-parsexlsx-176c2e79f2704af024e02d755b3dbb714ba72a70.zip
support more font properties (#14)
Diffstat (limited to 'lib/Spreadsheet/ParseXLSX.pm')
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm27
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index 381b16c..0c021c3 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -454,6 +454,8 @@ sub _parse_styles {
);
my @font = map {
+ my $vert = $_->first_child('vertAlign');
+ my $under = $_->first_child('u');
Spreadsheet::ParseExcel::Font->new(
Height => 0+$_->first_child('sz')->att('val'),
# Attr => $iAttr,
@@ -468,14 +470,31 @@ sub _parse_styles {
)
: '#000000'
),
- # Super => $iSuper,
- # UnderlineStyle => $iUnderline,
+ Super => ($vert
+ ? ($vert->att('val') eq 'superscript' ? 1
+ : $vert->att('val') eq 'subscript' ? 2
+ : 0)
+ : 0
+ ),
+ # XXX not sure what the single accounting and double accounting
+ # underline styles map to in xlsx. also need to map the new
+ # underline styles
+ UnderlineStyle => ($under
+ # XXX sometimes style xml files can contain just <u/> with no
+ # val attribute. i think this means single underline, but not
+ # sure
+ ? (!$under->att('val') ? 1
+ : $under->att('val') eq 'single' ? 1
+ : $under->att('val') eq 'double' ? 2
+ : 0)
+ : 0
+ ),
Name => $_->first_child('name')->att('val'),
Bold => $_->has_child('b') ? 1 : 0,
Italic => $_->has_child('i') ? 1 : 0,
- # Underline => $bUnderline,
- # Strikeout => $bStrikeout,
+ Underline => $_->has_child('u') ? 1 : 0,
+ Strikeout => $_->has_child('strike') ? 1 : 0,
)
} $styles->find_nodes('//fonts/font');