| 1 | package Spreadsheet::ParseExcel::FmtDefault; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Spreadsheet::ParseExcel::FmtDefault - A class for Cell formats. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Used in conjunction with Spreadsheet::ParseExcel. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Copyright (c) 2014 Douglas Wilson | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Copyright (c) 2009-2013 John McNamara | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Copyright (c) 2006-2008 Gabor Szabo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # Copyright (c) 2000-2006 Kawai Takanori | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # perltidy with standard settings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Documentation after __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 21 | ▶ | use Spreadsheet::ParseExcel::Utility qw(ExcelFmt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 21 | our $VERSION = '0.66'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 21 | my %hFmtDefault = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0x00 => 'General', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0x01 => '0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0x02 => '0.00', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0x03 => '#,##0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0x04 => '#,##0.00', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0x05 => '($#,##0_);($#,##0)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0x06 => '($#,##0_);[Red]($#,##0)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0x07 => '($#,##0.00_);($#,##0.00_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0x08 => '($#,##0.00_);[Red]($#,##0.00_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0x09 => '0%', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0x0A => '0.00%', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0x0B => '0.00E+00', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0x0C => '# ?/?', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0x0D => '# ??/??', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0x0E => 'yyyy-mm-dd', # Was 'm-d-yy', which is bad as system default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0x0F => 'd-mmm-yy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0x10 => 'd-mmm', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0x11 => 'mmm-yy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0x12 => 'h:mm AM/PM', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0x13 => 'h:mm:ss AM/PM', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0x14 => 'h:mm', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0x15 => 'h:mm:ss', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0x16 => 'm-d-yy h:mm', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | #0x17-0x24 -- Differs in Natinal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0x25 => '(#,##0_);(#,##0)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0x26 => '(#,##0_);[Red](#,##0)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0x27 => '(#,##0.00);(#,##0.00)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0x28 => '(#,##0.00);[Red](#,##0.00)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0x29 => '_(*#,##0_);_(*(#,##0);_(*"-"_);_(@_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0x2A => '_($*#,##0_);_($*(#,##0);_(*"-"_);_(@_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0x2B => '_(*#,##0.00_);_(*(#,##0.00);_(*"-"??_);_(@_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0x2C => '_($*#,##0.00_);_($*(#,##0.00);_(*"-"??_);_(@_)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0x2D => 'mm:ss', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0x2E => '[h]:mm:ss', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0x2F => 'mm:ss.0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0x30 => '##0.0E+0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0x31 => '@', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # new (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 37 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 37 | my ( $sPkg, %hKey ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 37 | my $oThis = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 37 | bless $oThis; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 37 | return $oThis; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # TextFmt (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1215 | ▶ | sub TextFmt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TextFmt: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1215 | my ( $oThis, $sTxt, $sCode ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1215 | ▶ | return $sTxt if ( ( !defined($sCode) ) || ( $sCode eq '_native_' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $sCode or $sCode eq "_native_"
MC/DC100%2/2
not defined $sCode or $sCode eq "_native_"
not defined $sCode
$sCode eq "_native_"
Truth table100%3/3
not(A) or B
A= not defined $sCodeB= $sCode eq "_native_"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 365 | return pack( 'U*', unpack( 'n*', $sTxt ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # FmtStringDef (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 387 | ▶ | sub FmtStringDef { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FmtStringDef: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 387 | my ( $oThis, $iFmtIdx, $oBook, $rhFmt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 387 | my $sFmtStr = $oBook->{FormatStr}->{$iFmtIdx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 387 | ▶ | if ( !( defined($sFmtStr) ) && defined($rhFmt) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $sFmtStr and defined $rhFmt
MC/DC100%2/2
not defined $sFmtStr and defined $rhFmt
not defined $sFmtStr
defined $rhFmt
Truth table100%3/3
not(A) and B
A= not defined $sFmtStrB= defined $rhFmt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 56 | $sFmtStr = $rhFmt->{$iFmtIdx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 387 | ▶ | $sFmtStr = $hFmtDefault{$iFmtIdx} unless ($sFmtStr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 387 | return $sFmtStr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # FmtString (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 387 | ▶ | sub FmtString { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FmtString: called CC=7 SCAR=32.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 387 | my ( $oThis, $oCell, $oBook ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | my $sFmtStr = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | $oThis->FmtStringDef( $oBook->{Format}[ $oCell->{FormatNo} ]->{FmtIdx}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 387 | $oBook ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # Special case for cells that use Lotus123 style leading | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # apostrophe to designate text formatting. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 387 | ▶ | if ( $oBook->{Format}[ $oCell->{FormatNo} ]->{Key123} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $sFmtStr = '@'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 387 | ▶ | unless ( defined($sFmtStr) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ( $oCell->{Type} eq 'Numeric' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ( int( $oCell->{Val} ) != $oCell->{Val} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $sFmtStr = '0.00'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $sFmtStr = '0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | elsif ( $oCell->{Type} eq 'Date' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if ( int( $oCell->{Val} ) <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $sFmtStr = 'h:mm:ss'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $sFmtStr = 'yyyy-mm-dd'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $sFmtStr = '@'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 387 | return $sFmtStr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # ValFmt (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1122 | ▶ | sub ValFmt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ValFmt: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1122 | my ( $oThis, $oCell, $oBook ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1122 | my ( $Dt, $iFmtIdx, $iNumeric, $Flg1904 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1122 | ▶ | if ( $oCell->{Type} eq 'Text' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | $Dt = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ( ( defined $oCell->{Val} ) && ( $oCell->{Val} ne '' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ? $oThis->TextFmt( $oCell->{Val}, $oCell->{Code} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 737 | ▶ | : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $oCell->{"Val"} and $oCell->{"Val"} ne ""
MC/DC50%1/2
defined $oCell->{"Val"} and $oCell->{"Val"} ne ""
defined $oCell->{"Val"}
$oCell->{"Val"} ne ""
Truth table66%2/3
A and B
A= defined $oCell->{"Val"}B= $oCell->{"Val"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 737 | return $Dt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 385 | $Dt = $oCell->{Val}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 385 | $Flg1904 = $oBook->{Flg1904}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 385 | my $sFmtStr = $oThis->FmtString( $oCell, $oBook ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 385 | return ExcelFmt( $sFmtStr, $Dt, $Flg1904, $oCell->{Type} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # ChkType (for Spreadsheet::ParseExcel::FmtDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1122 | ▶ | sub ChkType { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ChkType: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1122 | my ( $oPkg, $iNumeric, $iFmtIdx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1122 | ▶ | if ($iNumeric) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 385 | ▶ | if ( ( ( $iFmtIdx >= 0x0E ) && ( $iFmtIdx <= 0x16 ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$iFmtIdx >= 14 and $iFmtIdx <= 22 or $iFmtIdx >= 45 and $iFmtIdx <= 47
$iFmtIdx >= 14 and $iFmtIdx <= 22
$iFmtIdx >= 45 and $iFmtIdx <= 47
MC/DC50%2/4
$iFmtIdx >= 14 and $iFmtIdx <= 22 or $iFmtIdx >= 45 and $iFmtIdx <= 47
$iFmtIdx >= 14
$iFmtIdx <= 22
$iFmtIdx >= 45
$iFmtIdx <= 47
Truth table57%4/7
A and B or C and D
A= $iFmtIdx >= 14B= $iFmtIdx <= 22C= $iFmtIdx >= 45D= $iFmtIdx <= 47
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | || ( ( $iFmtIdx >= 0x2D ) && ( $iFmtIdx <= 0x2F ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 49 | return "Date"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 336 | return "Numeric"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 737 | return "Text"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 21 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||