.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Spreadsheet::XLSX::Utility2007 3pm" .TH Spreadsheet::XLSX::Utility2007 3pm 2024-03-16 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Spreadsheet::XLSX::Utility2007 \- Utility function for Spreadsheet::XLSX .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 3 \& use strict; \& #Declare \& use Spreadsheet::XLSX::Utility2007 qw(ExcelFmt ExcelLocaltime LocaltimeExcel); \& \& #Convert localtime \->Excel Time \& my $iBirth = LocaltimeExcel(11, 10, 12, 23, 2, 64); \& # = 1964\-3\-23 12:10:11 \& print $iBirth, "\en"; # 23459.5070717593 \& \& #Convert Excel Time \-> localtime \& my @aBirth = ExcelLocaltime($iBirth, undef); \& print join(":", @aBirth), "\en"; # 11:10:12:23:2:64:1:0 \& \& #Formatting \& print ExcelFmt(\*(Aqyyyy\-mm\-dd\*(Aq, $iBirth), "\en"; #1964\-3\-23 \& print ExcelFmt(\*(Aqm\-d\-yy\*(Aq, $iBirth), "\en"; # 3\-23\-64 \& print ExcelFmt(\*(Aq#,##0\*(Aq, $iBirth), "\en"; # 23,460 \& print ExcelFmt(\*(Aq#,##0.00\*(Aq, $iBirth), "\en"; # 23,459.51 \& print ExcelFmt(\*(Aq"My Birthday is (m/d):" m/d\*(Aq, $iBirth), "\en"; \& # My Birthday is (m/d): 3/23 .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Spreadsheet::XLSX::Utility2007 exports utility functions concerned with Excel format setting. .PP ExcelFmt is used by Spreadsheet::XLSX::Fmt2007.pm which is used by Spreadsheet::XLSX. .SH Functions .IX Header "Functions" This module can export 3 functions: ExcelFmt, ExcelLocaltime and LocaltimeExcel. .SS ExcelFmt .IX Subsection "ExcelFmt" \&\f(CW$sTxt\fR = ExcelFmt($sFmt, \f(CW$iData\fR [, \f(CW$i1904\fR]); .PP \&\fR\f(CI$sFmt\fR\fI\fR is a format string for Excel. \fI\fR\f(CI$iData\fR\fI\fR is the target value. If \fI\fR\f(CI$flg1904\fR\fI\fR is true, this functions assumes that epoch is 1904. \&\fI\fR\f(CI$sTxt\fR\fI\fR is the result. .PP For more detail and examples, please refer sample/chkFmt.pl in this distribution. .PP ex. .SS ExcelLocaltime .IX Subsection "ExcelLocaltime" ($iSec, \f(CW$iMin\fR, \f(CW$iHour\fR, \f(CW$iDay\fR, \f(CW$iMon\fR, \f(CW$iYear\fR, \f(CW$iwDay\fR, \f(CW$iMSec\fR) = ExcelLocaltime($iExTime [, \f(CW$flg1904\fR]); .PP \&\fIExcelLocaltime\fR converts time information in Excel format into Perl localtime format. \&\fR\f(CI$iExTime\fR\fI\fR is a time of Excel. If \fI\fR\f(CI$flg1904\fR\fI\fR is true, this functions assumes that epoch is 1904. \&\fI\fR\f(CI$iSec\fR\fI\fR, \fI\fR\f(CI$iMin\fR\fI\fR, \fI\fR\f(CI$iHour\fR\fI\fR, \fI\fR\f(CI$iDay\fR\fI\fR, \fI\fR\f(CI$iMon\fR\fI\fR, \fI\fR\f(CI$iYear\fR\fI\fR, \fI\fR\f(CI$iwDay\fR\fI\fR are same as localtime. \&\fI\fR\f(CI$iMSec\fR\fI\fR means 1/1,000,000 seconds(ms). .SS LocaltimeExcel .IX Subsection "LocaltimeExcel" \&\fR\f(CI$iExTime\fR\fI\fR = LocaltimeExcel($iSec, \f(CW$iMin\fR, \f(CW$iHour\fR, \f(CW$iDay\fR, \f(CW$iMon\fR, \f(CW$iYear\fR [,$iMSec] [,$flg1904]) .PP \&\fILocaltimeExcel\fR converts time information in Perl localtime format into Excel format . \&\fR\f(CI$iSec\fR\fI\fR, \fI\fR\f(CI$iMin\fR\fI\fR, \fI\fR\f(CI$iHour\fR\fI\fR, \fI\fR\f(CI$iDay\fR\fI\fR, \fI\fR\f(CI$iMon\fR\fI\fR, \fI\fR\f(CI$iYear\fR\fI\fR are same as localtime. .PP If \fR\f(CI$flg1904\fR\fI\fR is true, this functions assumes that epoch is 1904. \&\fI\fR\f(CI$iExTime\fR\fI\fR is a time of Excel. .SS col2int .IX Subsection "col2int" \&\fR\f(CI$iInt\fR\fI\fR = col2int($sCol); .PP converts a excel row letter into an int for use in an array .PP This function was contributed by Kevin Mulholland. .SS int2col .IX Subsection "int2col" \&\fR\f(CI$sCol\fR\fI\fR = int2col($iRow); .PP convert a column number into column letters NOET: This is quite a brute force coarse method does not manage values over 701 (ZZ) .PP This function was contributed by Kevin Mulholland. .SS sheetRef .IX Subsection "sheetRef" (\fR\f(CI$iRow\fR\fI\fR, \fI\fR\f(CI$iCol\fR\fI\fR) = sheetRef($sStr); .PP convert an excel letter-number address into a useful array address NOTE: That also Excel uses X\-Y notation, we normally use Y\-X in arrays \&\f(CW$sStr\fR, excel coord (eg. A2). .PP This function was contributed by Kevin Mulholland. .SS xls2csv .IX Subsection "xls2csv" \&\f(CW$sCsvTxt\fR = xls2csv($sFileName, \f(CW$sRegion\fR, \f(CW$iRotate\fR); .PP convert a chunk of an excel file into csv text chunk \&\f(CW$sRegions\fR = "sheet\-colrow:colrow" (ex. '1\-A1:B2' means 'A1:B2' for sheet 1) \&\f(CW$iRotate\fR = 0 or 1 (output should be rotated or not) .PP This function was contributed by Kevin Mulholland. .SH AUTHOR .IX Header "AUTHOR" Rob Polocz rob.polocz@trackvia.com based on work by for Spreadsheet::ParseExcel by Kawai Takanori (Hippo2000) used with permission .SH "SEE ALSO" .IX Header "SEE ALSO" Spreadsheet::ParseExcel, Spreadsheet::WriteExcel .SH COPYRIGHT .IX Header "COPYRIGHT" This module is part of the Spreadsheet::XLSX distribution.