1Spreadsheet::ParseExcelU:s:eCrelClo(n3t)ributed Perl DocSupmreenatdasthieoent::ParseExcel::Cell(3)
2
3
4

NAME

6       Spreadsheet::ParseExcel::Cell - A class for Cell data and formatting.
7

SYNOPSIS

9       See the documentation for Spreadsheet::ParseExcel.
10

DESCRIPTION

12       This module is used in conjunction with Spreadsheet::ParseExcel. See
13       the documentation for Spreadsheet::ParseExcel.
14

Methods

16       The following Cell methods are available:
17
18           $cell->value()
19           $cell->unformatted()
20           $cell->get_format()
21           $cell->type()
22           $cell->encoding()
23           $cell->is_merged()
24           $cell->get_rich_text()
25           $cell->get_hyperlink()
26
27   value()
28       The "value()" method returns the formatted value of the cell.
29
30           my $value = $cell->value();
31
32       Formatted in this sense refers to the numeric format of the cell value.
33       For example a number such as 40177 might be formatted as 40,117,
34       40117.000 or even as the date 2009/12/30.
35
36       If the cell doesn't contain a numeric format then the formatted and
37       unformatted cell values are the same, see the "unformatted()" method
38       below.
39
40       For a defined $cell the "value()" method will always return a value.
41
42       In the case of a cell with formatting but no numeric or string contents
43       the method will return the empty string ''.
44
45   unformatted()
46       The "unformatted()" method returns the unformatted value of the cell.
47
48           my $unformatted = $cell->unformatted();
49
50       Returns the cell value without a numeric format. See the "value()"
51       method above.
52
53   get_format()
54       The "get_format()" method returns the Spreadsheet::ParseExcel::Format
55       object for the cell.
56
57           my $format = $cell->get_format();
58
59       If a user defined format hasn't been applied to the cell then the
60       default cell format is returned.
61
62   type()
63       The "type()" method returns the type of cell such as Text, Numeric or
64       Date. If the type was detected as Numeric, and the Cell Format matches
65       "m{^[dmy][-\\/dmy]*$}i", it will be treated as a Date type.
66
67           my $type = $cell->type();
68
69       See also "Dates and Time in Excel".
70
71   encoding()
72       The "encoding()" method returns the character encoding of the cell.
73
74           my $encoding = $cell->encoding();
75
76       This method is only of interest to developers. In general
77       Spreadsheet::ParseExcel will return all character strings in UTF-8
78       regardless of the encoding used by Excel.
79
80       The "encoding()" method returns one of the following values:
81
82       ·   0: Unknown format. This shouldn't happen. In the default case the
83           format should be 1.
84
85       ·   1: 8bit ASCII or single byte UTF-16. This indicates that the
86           characters are encoded in a single byte. In Excel 95 and earlier
87           This usually meant ASCII or an international variant. In Excel 97
88           it refers to a compressed UTF-16 character string where all of the
89           high order bytes are 0 and are omitted to save space.
90
91       ·   2: UTF-16BE.
92
93       ·   3: Native encoding. In Excel 95 and earlier this encoding was used
94           to represent multi-byte character encodings such as SJIS.
95
96   is_merged()
97       The "is_merged()" method returns true if the cell is merged.
98
99           my $is_merged = $cell->is_merged();
100
101       Returns "undef" if the property isn't set.
102
103   get_rich_text()
104       The "get_rich_text()" method returns an array ref of font information
105       about each string block in a "rich", i.e. multi-format, string.
106
107           my $rich_text = $cell->get_rich_text();
108
109       The return value is an arrayref of arrayrefs in the form:
110
111           [
112               [ $start_position, $font_object ],
113                ...,
114           ]
115
116       Returns undef if the property isn't set.
117
118   get_hyperlink()
119       If a cell contains a hyperlink, the "get_hyperlink()" method returns an
120       array ref of information about it.
121
122       A cell can contain at most one hyperlink.  If it does, it contains no
123       other value.
124
125       Otherwise, it returns undef;
126
127       The array contains:
128
129       ·   0: Description (what's displayed); undef if not present
130
131       ·   1: Link, converted to an appropriate URL - Note: Relative links are
132           based on the input file.  %REL% is used if the input file is
133           unknown (e.g. a file handle or scalar)
134
135       ·   2: Target - target frame (or undef if none)
136

Dates and Time in Excel

138       Dates and times in Excel are represented by real numbers, for example
139       "Jan 1 2001 12:30 PM" is represented by the number 36892.521.
140
141       The integer part of the number stores the number of days since the
142       epoch and the fractional part stores the percentage of the day.
143
144       A date or time in Excel is just like any other number. The way in which
145       it is displayed is controlled by the number format:
146
147           Number format               $cell->value()            $cell->unformatted()
148           =============               ==============            ==============
149           'dd/mm/yy'                  '28/02/08'                39506.5
150           'mm/dd/yy'                  '02/28/08'                39506.5
151           'd-m-yyyy'                  '28-2-2008'               39506.5
152           'dd/mm/yy hh:mm'            '28/02/08 12:00'          39506.5
153           'd mmm yyyy'                '28 Feb 2008'             39506.5
154           'mmm d yyyy hh:mm AM/PM'    'Feb 28 2008 12:00 PM'    39506.5
155
156       The Spreadsheet::ParseExcel::Utility module contains a function called
157       "ExcelLocaltime" which will convert between an unformatted Excel
158       date/time number and a "localtime()" like array.
159
160       For date conversions using the CPAN "DateTime" framework see
161       DateTime::Format::Excel
162       http://search.cpan.org/search?dist=DateTime-Format-Excel
163

AUTHOR

165       Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
166
167       Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
168
169       Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
170
171       Original author: Kawai Takanori kwitknr@cpan.org
172
174       Copyright (c) 2014 Douglas Wilson
175
176       Copyright (c) 2009-2013 John McNamara
177
178       Copyright (c) 2006-2008 Gabor Szabo
179
180       Copyright (c) 2000-2006 Kawai Takanori
181
182       All rights reserved.
183
184       You may distribute under the terms of either the GNU General Public
185       License or the Artistic License, as specified in the Perl README file.
186
187
188
189perl v5.30.1                      2020-01-30  Spreadsheet::ParseExcel::Cell(3)
Impressum