1Spreadsheet::XLSX::UtilUisteyr20C0o7n(t3r)ibuted Perl DoScpurmeeandtsahteieotn::XLSX::Utility2007(3)
2
3
4
6 Spreadsheet::XLSX::Utility2007 - Utility function for Spreadsheet::XLSX
7
9 use strict;
10 #Declare
11 use Spreadsheet::XLSX::Utility qw(ExcelFmt ExcelLocaltime LocaltimeExcel);
12
13 #Convert localtime ->Excel Time
14 my $iBirth = LocaltimeExcel(11, 10, 12, 23, 2, 64);
15 # = 1964-3-23 12:10:11
16 print $iBirth, "\n"; # 23459.5070717593
17
18 #Convert Excel Time -> localtime
19 my @aBirth = ExcelLocaltime($iBirth, undef);
20 print join(":", @aBirth), "\n"; # 11:10:12:23:2:64:1:0
21
22 #Formatting
23 print ExcelFmt('yyyy-mm-dd', $iBirth), "\n"; #1964-3-23
24 print ExcelFmt('m-d-yy', $iBirth), "\n"; # 3-23-64
25 print ExcelFmt('#,##0', $iBirth), "\n"; # 23,460
26 print ExcelFmt('#,##0.00', $iBirth), "\n"; # 23,459.51
27 print ExcelFmt('"My Birthday is (m/d):" m/d', $iBirth), "\n";
28 # My Birthday is (m/d): 3/23
29
31 Spreadsheet::XLSX::Utility exports utility functions concerned with
32 Excel format setting.
33
34 ExcelFmt is used by Spreadsheet::XLSX::Fmt2007.pm which is used by
35 Spreadsheet::XLSX.
36
38 This module can export 3 functions: ExcelFmt, ExcelLocaltime and
39 LocaltimeExcel.
40
41 ExcelFmt
42 $sTxt = ExcelFmt($sFmt, $iData [, $i1904]);
43
44 $sFmt is a format string for Excel. $iData is the target value. If
45 $flg1904 is true, this functions assumes that epoch is 1904. $sTxt is
46 the result.
47
48 For more detail and examples, please refer sample/chkFmt.pl in this
49 distribution.
50
51 ex.
52
53 ExcelLocaltime
54 ($iSec, $iMin, $iHour, $iDay, $iMon, $iYear, $iwDay, $iMSec) =
55 ExcelLocaltime($iExTime [, $flg1904]);
56
57 ExcelLocaltime converts time information in Excel format into Perl
58 localtime format. $iExTime is a time of Excel. If $flg1904 is true,
59 this functions assumes that epoch is 1904. $iSec, $iMin, $iHour,
60 $iDay, $iMon, $iYear, $iwDay are same as localtime. $iMSec means
61 1/1,000,000 seconds(ms).
62
63 LocaltimeExcel
64 $iExTime = LocaltimeExcel($iSec, $iMin, $iHour, $iDay, $iMon, $iYear
65 [,$iMSec] [,$flg1904])
66
67 LocaltimeExcel converts time information in Perl localtime format into
68 Excel format . $iSec, $iMin, $iHour, $iDay, $iMon, $iYear are same as
69 localtime.
70
71 If $flg1904 is true, this functions assumes that epoch is 1904.
72 $iExTime is a time of Excel.
73
74 col2int
75 $iInt = col2int($sCol);
76
77 converts a excel row letter into an int for use in an array
78
79 This function was contributed by Kevin Mulholland.
80
81 int2col
82 $sCol = int2col($iRow);
83
84 convert a column number into column letters NOET: This is quite a brute
85 force coarse method does not manage values over 701 (ZZ)
86
87 This function was contributed by Kevin Mulholland.
88
89 sheetRef
90 ($iRow, $iCol) = sheetRef($sStr);
91
92 convert an excel letter-number address into a useful array address
93 NOTE: That also Excel uses X-Y notation, we normally use Y-X in arrays
94 $sStr, excel coord (eg. A2).
95
96 This function was contributed by Kevin Mulholland.
97
98 xls2csv
99 $sCsvTxt = xls2csv($sFileName, $sRegion, $iRotate);
100
101 convert a chunk of an excel file into csv text chunk $sRegions =
102 "sheet-colrow:colrow" (ex. '1-A1:B2' means 'A1:B2' for sheet 1)
103 $iRotate = 0 or 1 (output should be rotated or not)
104
105 This function was contributed by Kevin Mulholland.
106
108 Rob Polocz rob.polocz@trackvia.com based on work by for
109 Spreadsheet::ParseExcel by Kawai Takanori (Hippo2000) used with
110 permission
111
113 Spreadsheet::ParseExcel, Spreadsheet::WriteExcel
114
116 This module is part of the Spreadsheet::XLSX distribution.
117
118
119
120perl v5.28.1 2015-04-22 Spreadsheet::XLSX::Utility2007(3)