File tree 5 files changed +20
-15
lines changed
samples/Wizards/NumberFormat
5 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PhpOffice \PhpSpreadsheet \Exception ;
3
+ use PhpOffice \PhpSpreadsheet \Exception as SpreadsheetException ;
4
4
use PhpOffice \PhpSpreadsheet \Helper \Sample ;
5
5
use PhpOffice \PhpSpreadsheet \Settings ;
6
6
use PhpOffice \PhpSpreadsheet \Style \NumberFormat ;
90
90
(isset ($ _POST ['thousands ' ]) ? 'WITH_THOUSANDS_SEPARATOR ' : 'WITHOUT_THOUSANDS_SEPARATOR ' ) .
91
91
', Wizard\Currency:: ' . (((bool ) $ _POST ['position ' ]) ? 'LEADING_SYMBOL ' : 'TRAILING_SYMBOL ' ) .
92
92
', Wizard\Currency:: ' . (((bool ) $ _POST ['spacing ' ]) ? 'SYMBOL_WITH_SPACING ' : 'SYMBOL_WITHOUT_SPACING ' ) .
93
- ')<br /> '
93
+ '); <br /> '
94
94
);
95
+ $ helper ->log ('echo (string) $mask; ' );
95
96
$ helper ->log ('<hr /><b>Mask:</b><br /> ' );
96
97
$ helper ->log ($ mask . '<br /> ' );
97
98
$ helper ->log ('<br /><b>Example:</b><br /> ' );
98
99
$ helper ->log ($ example );
99
- } catch (Exception $ e ) {
100
+ } catch (SpreadsheetException $ e ) {
100
101
$ helper ->log ("Exception: {$ e ->getMessage ()}" );
101
102
}
102
103
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PhpOffice \PhpSpreadsheet \Exception ;
3
+ use PhpOffice \PhpSpreadsheet \Exception as SpreadsheetException ;
4
4
use PhpOffice \PhpSpreadsheet \Helper \Sample ;
5
5
use PhpOffice \PhpSpreadsheet \Settings ;
6
6
use PhpOffice \PhpSpreadsheet \Style \NumberFormat ;
90
90
(isset ($ _POST ['thousands ' ]) ? 'WITH_THOUSANDS_SEPARATOR ' : 'WITHOUT_THOUSANDS_SEPARATOR ' ) .
91
91
', Wizard\Currency:: ' . (((bool ) $ _POST ['position ' ]) ? 'LEADING_SYMBOL ' : 'TRAILING_SYMBOL ' ) .
92
92
', Wizard\Currency:: ' . (((bool ) $ _POST ['spacing ' ]) ? 'SYMBOL_WITH_SPACING ' : 'SYMBOL_WITHOUT_SPACING ' ) .
93
- ')<br /> '
93
+ '); <br /> '
94
94
);
95
+ $ helper ->log ('echo (string) $mask; ' );
95
96
$ helper ->log ('<hr /><b>Mask:</b><br /> ' );
96
97
$ helper ->log ($ mask . '<br /> ' );
97
98
$ helper ->log ('<br /><b>Example:</b><br /> ' );
98
99
$ helper ->log ($ example );
99
- } catch (Exception $ e ) {
100
+ } catch (SpreadsheetException $ e ) {
100
101
$ helper ->log ("Exception: {$ e ->getMessage ()}" );
101
102
}
102
103
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PhpOffice \PhpSpreadsheet \Exception ;
3
+ use PhpOffice \PhpSpreadsheet \Exception as SpreadsheetException ;
4
4
use PhpOffice \PhpSpreadsheet \Helper \Sample ;
5
5
use PhpOffice \PhpSpreadsheet \Settings ;
6
6
use PhpOffice \PhpSpreadsheet \Style \NumberFormat ;
61
61
$ helper ->log (
62
62
"\$mask = Wizard \\Number( {$ _POST ['decimals ' ]}, Wizard \\Number:: " .
63
63
(isset ($ _POST ['thousands ' ]) ? 'WITH_THOUSANDS_SEPARATOR ' : 'WITHOUT_THOUSANDS_SEPARATOR ' ) .
64
- ')<br /> '
64
+ '); <br /> '
65
65
);
66
+ $ helper ->log ('echo (string) $mask; ' );
66
67
$ helper ->log ('<hr /><b>Mask:</b> ' );
67
68
$ helper ->log ($ mask );
68
69
$ helper ->log ('<b>Example:</b> ' );
69
70
$ helper ->log ($ example );
70
- } catch (Exception $ e ) {
71
+ } catch (SpreadsheetException $ e ) {
71
72
$ helper ->log ("Exception: {$ e ->getMessage ()}" );
72
73
}
73
74
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PhpOffice \PhpSpreadsheet \Exception ;
3
+ use PhpOffice \PhpSpreadsheet \Exception as SpreadsheetException ;
4
4
use PhpOffice \PhpSpreadsheet \Helper \Sample ;
5
5
use PhpOffice \PhpSpreadsheet \Settings ;
6
6
use PhpOffice \PhpSpreadsheet \Style \NumberFormat ;
52
52
$ example = (string ) NumberFormat::toFormattedString ((float ) $ _POST ['number ' ], $ mask );
53
53
$ helper ->log ('<hr /><b>Code:</b><br /> ' );
54
54
$ helper ->log ('use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard; ' );
55
- $ helper ->log ("\$mask = Wizard \\Percentage( {$ _POST ['decimals ' ]})<br /> " );
55
+ $ helper ->log ("\$mask = Wizard \\Percentage( {$ _POST ['decimals ' ]});<br /> " );
56
+ $ helper ->log ('echo (string) $mask; ' );
56
57
$ helper ->log ('<hr /><b>Mask:</b><br /> ' );
57
58
$ helper ->log ($ mask . '<br /> ' );
58
59
$ helper ->log ('<br /><b>Example:</b><br /> ' );
59
60
$ helper ->log ($ example );
60
- } catch (Exception $ e ) {
61
+ } catch (SpreadsheetException $ e ) {
61
62
$ helper ->log ("Exception: {$ e ->getMessage ()}" );
62
63
}
63
64
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- use PhpOffice \PhpSpreadsheet \Exception ;
3
+ use PhpOffice \PhpSpreadsheet \Exception as SpreadsheetException ;
4
4
use PhpOffice \PhpSpreadsheet \Helper \Sample ;
5
5
use PhpOffice \PhpSpreadsheet \Settings ;
6
6
use PhpOffice \PhpSpreadsheet \Style \NumberFormat ;
52
52
$ example = (string ) NumberFormat::toFormattedString ((float ) $ _POST ['number ' ], $ mask );
53
53
$ helper ->log ('<hr /><b>Code:</b><br /> ' );
54
54
$ helper ->log ('use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard; ' );
55
- $ helper ->log ("\$mask = Wizard \\Scientific( {$ _POST ['decimals ' ]})<br /> " );
55
+ $ helper ->log ("\$mask = Wizard \\Scientific( {$ _POST ['decimals ' ]});<br /> " );
56
+ $ helper ->log ('echo (string) $mask; ' );
56
57
$ helper ->log ('<hr /><b>Mask:</b><br /> ' );
57
58
$ helper ->log ($ mask . '<br /> ' );
58
59
$ helper ->log ('<br /><b>Example:</b><br /> ' );
59
60
$ helper ->log ($ example );
60
- } catch (Exception $ e ) {
61
+ } catch (SpreadsheetException $ e ) {
61
62
$ helper ->log ("Exception: {$ e ->getMessage ()}" );
62
63
}
63
64
}
You can’t perform that action at this time.
0 commit comments