1Spreadsheet::ParseExcelU:s:eUrtiClointtyr(i3b)uted PerlSDporceuamdesnhteaetti:o:nParseExcel::Utility(3)
2
3
4

NAME

6       Spreadsheet::ParseExcel::Utility - Utility function for Spread‐
7       sheet::ParseExcel
8

SYNOPSIS

10           use strict;
11           #Declare
12           use Spreadsheet::ParseExcel::Utility qw(ExcelFmt ExcelLocaltime LocaltimeExcel);
13
14           #Convert localtime ->Excel Time
15           my $iBirth = LocaltimeExcel(11, 10, 12, 23, 2, 64);
16                                      # = 1964-3-23 12:10:11
17           print $iBirth, "\n";       # 23459.5070717593
18
19           #Convert Excel Time -> localtime
20           my @aBirth = ExcelLocaltime($iBirth, undef);
21           print join(":", @aBirth), "\n";   # 11:10:12:23:2:64:1:0
22
23           #Formatting
24           print ExcelFmt('yyyy-mm-dd', $iBirth), "\n"; #1964-3-23
25           print ExcelFmt('m-d-yy', $iBirth), "\n";     # 3-23-64
26           print ExcelFmt('#,##0', $iBirth), "\n";      # 23,460
27           print ExcelFmt('#,##0.00', $iBirth), "\n";   # 23,459.51
28           print ExcelFmt('"My Birthday is (m/d):" m/d', $iBirth), "\n";
29                                             # My Birthday is (m/d): 3/23
30

DESCRIPTION

32       Spreadsheet::ParseExcel::Utility exports utility functions concerned
33       with Excel format setting.
34

Functions

36       This module can export 3 functions: ExcelFmt, ExcelLocaltime and Local‐
37       timeExcel.
38
39       ExcelFmt
40
41       $sTxt = ExcelFmt($sFmt, $iData [, $i1904]);
42
43       $sFmt is a format string for Excel. $iData is the target value.  If
44       $flg1904 is true, this functions assumes that epoch is 1904.  $sTxt is
45       the result.
46
47       For more detail and examples, please refer sample/chkFmt.pl in this
48       distribution.
49
50       ex.
51
52       ExcelLocaltime
53
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
65       $iExTime = LocaltimeExcel($iSec, $iMin, $iHour, $iDay, $iMon, $iYear
66       [,$iMSec] [,$flg1904])
67
68       LocaltimeExcel converts time information in Perl localtime format into
69       Excel format .  $iSec, $iMin, $iHour, $iDay, $iMon, $iYear are same as
70       localtime.
71
72       If $flg1904 is true, this functions assumes that epoch is 1904.  $iEx‐
73       Time is a time of Excel.
74
75       col2int
76
77       $iInt = col2int($sCol);
78
79       converts a excel row letter into an int for use in an array
80
81       This function was contributed by Kevin Mulholland.
82
83       int2col
84
85       $sCol = int2col($iRow);
86
87       convert a column number into column letters NOET: This is quite a brute
88       force coarse method does not manage values over 701 (ZZ)
89
90       This function was contributed by Kevin Mulholland.
91
92       sheetRef
93
94       ($iRow, $iCol) = sheetRef($sStr);
95
96       convert an excel letter-number address into a useful array address
97       NOTE: That also Excel uses X-Y notation, we normally use Y-X in arrays
98       $sStr, excel coord (eg. A2).
99
100       This function was contributed by Kevin Mulholland.
101
102       xls2csv
103
104       $sCsvTxt = xls2csv($sFileName, $sRegion, $iRotate);
105
106       convert a chunk of an excel file into csv text chunk $sRegions =
107       "sheet-colrow:colrow" (ex. '1-A1:B2' means 'A1:B2' for sheet 1) $iRo‐
108       tate  = 0 or 1 (output should be rotated or not)
109
110       This function was contributed by Kevin Mulholland.
111

AUTHOR

113       Kawai Takanori (Hippo2000) kwitknr@cpan.org
114
115           http://member.nifty.ne.jp/hippo2000/            (Japanese)
116           http://member.nifty.ne.jp/hippo2000/index_e.htm (English)
117

SEE ALSO

119       Spreadsheet::ParseExcel, Spreadsheet::WriteExcel
120
122       This module is part of the Spreadsheet::ParseExcel distribution.
123
124
125
126perl v5.8.8                       2007-04-09Spreadsheet::ParseExcel::Utility(3)
Impressum