Initial Commit
This commit is contained in:
361
database/perl/vendor/lib/Spreadsheet/ParseExcel/Cell.pm
vendored
Normal file
361
database/perl/vendor/lib/Spreadsheet/ParseExcel/Cell.pm
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
package Spreadsheet::ParseExcel::Cell;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::Cell - A class for Cell data and formatting.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# new()
|
||||
#
|
||||
# Constructor.
|
||||
#
|
||||
sub new {
|
||||
my ( $package, %properties ) = @_;
|
||||
my $self = \%properties;
|
||||
|
||||
bless $self, $package;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# value()
|
||||
#
|
||||
# Returns the formatted value of the cell.
|
||||
#
|
||||
sub value {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{_Value};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# unformatted()
|
||||
#
|
||||
# Returns the unformatted value of the cell.
|
||||
#
|
||||
sub unformatted {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Val};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_format()
|
||||
#
|
||||
# Returns the Format object for the cell.
|
||||
#
|
||||
sub get_format {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Format};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# type()
|
||||
#
|
||||
# Returns the type of cell such as Text, Numeric or Date.
|
||||
#
|
||||
sub type {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Type};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# encoding()
|
||||
#
|
||||
# Returns the character encoding of the cell.
|
||||
#
|
||||
sub encoding {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
if ( !defined $self->{Code} ) {
|
||||
return 1;
|
||||
}
|
||||
elsif ( $self->{Code} eq 'ucs2' ) {
|
||||
return 2;
|
||||
}
|
||||
elsif ( $self->{Code} eq '_native_' ) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $self->{Code};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# is_merged()
|
||||
#
|
||||
# Returns true if the cell is merged.
|
||||
#
|
||||
sub is_merged {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Merged};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_rich_text()
|
||||
#
|
||||
# Returns an array ref of font information about each string block in a "rich",
|
||||
# i.e. multi-format, string.
|
||||
#
|
||||
sub get_rich_text {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Rich};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_hyperlink {
|
||||
#
|
||||
# Returns an array ref of hyperlink information if the cell contains a hyperlink.
|
||||
# Returns undef otherwise
|
||||
#
|
||||
# [0] : Description of link (You may want $cell->value, as it will have rich text)
|
||||
# [1] : URL - the link expressed as a URL. N.B. relative URLs will be defaulted to
|
||||
# the directory of the input file, if the input file name is known. Otherwise
|
||||
# %REL% will be inserted as a place-holder. Depending on your application,
|
||||
# you should either remove %REL% or replace it with the appropriate path.
|
||||
# [2] : Target frame (or undef if none)
|
||||
|
||||
sub get_hyperlink {
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Hyperlink} if exists $self->{Hyperlink};
|
||||
return undef;
|
||||
}
|
||||
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# Mapping between legacy method names and new names.
|
||||
#
|
||||
{
|
||||
no warnings; # Ignore warnings about variables used only once.
|
||||
*Value = \&value;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::Cell - A class for Cell data and formatting.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 Methods
|
||||
|
||||
The following Cell methods are available:
|
||||
|
||||
$cell->value()
|
||||
$cell->unformatted()
|
||||
$cell->get_format()
|
||||
$cell->type()
|
||||
$cell->encoding()
|
||||
$cell->is_merged()
|
||||
$cell->get_rich_text()
|
||||
$cell->get_hyperlink()
|
||||
|
||||
|
||||
=head2 value()
|
||||
|
||||
The C<value()> method returns the formatted value of the cell.
|
||||
|
||||
my $value = $cell->value();
|
||||
|
||||
Formatted in this sense refers to the numeric format of the cell value. For example a number such as 40177 might be formatted as 40,117, 40117.000 or even as the date 2009/12/30.
|
||||
|
||||
If the cell doesn't contain a numeric format then the formatted and unformatted cell values are the same, see the C<unformatted()> method below.
|
||||
|
||||
For a defined C<$cell> the C<value()> method will always return a value.
|
||||
|
||||
In the case of a cell with formatting but no numeric or string contents the method will return the empty string C<''>.
|
||||
|
||||
|
||||
=head2 unformatted()
|
||||
|
||||
The C<unformatted()> method returns the unformatted value of the cell.
|
||||
|
||||
my $unformatted = $cell->unformatted();
|
||||
|
||||
Returns the cell value without a numeric format. See the C<value()> method above.
|
||||
|
||||
|
||||
=head2 get_format()
|
||||
|
||||
The C<get_format()> method returns the L<Spreadsheet::ParseExcel::Format> object for the cell.
|
||||
|
||||
my $format = $cell->get_format();
|
||||
|
||||
If a user defined format hasn't been applied to the cell then the default cell format is returned.
|
||||
|
||||
|
||||
=head2 type()
|
||||
|
||||
The C<type()> method returns the type of cell such as Text, Numeric or Date. If the type was detected as Numeric, and the Cell Format matches C<m{^[dmy][-\\/dmy]*$}i>, it will be treated as a Date type.
|
||||
|
||||
my $type = $cell->type();
|
||||
|
||||
See also L<Dates and Time in Excel>.
|
||||
|
||||
|
||||
=head2 encoding()
|
||||
|
||||
The C<encoding()> method returns the character encoding of the cell.
|
||||
|
||||
my $encoding = $cell->encoding();
|
||||
|
||||
This method is only of interest to developers. In general Spreadsheet::ParseExcel will return all character strings in UTF-8 regardless of the encoding used by Excel.
|
||||
|
||||
The C<encoding()> method returns one of the following values:
|
||||
|
||||
=over
|
||||
|
||||
=item * 0: Unknown format. This shouldn't happen. In the default case the format should be 1.
|
||||
|
||||
=item * 1: 8bit ASCII or single byte UTF-16. This indicates that the characters are encoded in a single byte. In Excel 95 and earlier This usually meant ASCII or an international variant. In Excel 97 it refers to a compressed UTF-16 character string where all of the high order bytes are 0 and are omitted to save space.
|
||||
|
||||
=item * 2: UTF-16BE.
|
||||
|
||||
=item * 3: Native encoding. In Excel 95 and earlier this encoding was used to represent multi-byte character encodings such as SJIS.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head2 is_merged()
|
||||
|
||||
The C<is_merged()> method returns true if the cell is merged.
|
||||
|
||||
my $is_merged = $cell->is_merged();
|
||||
|
||||
Returns C<undef> if the property isn't set.
|
||||
|
||||
|
||||
=head2 get_rich_text()
|
||||
|
||||
The C<get_rich_text()> method returns an array ref of font information about each string block in a "rich", i.e. multi-format, string.
|
||||
|
||||
my $rich_text = $cell->get_rich_text();
|
||||
|
||||
The return value is an arrayref of arrayrefs in the form:
|
||||
|
||||
[
|
||||
[ $start_position, $font_object ],
|
||||
...,
|
||||
]
|
||||
|
||||
Returns undef if the property isn't set.
|
||||
|
||||
=head2 get_hyperlink()
|
||||
|
||||
If a cell contains a hyperlink, the C<get_hyperlink()> method returns an array ref of information about it.
|
||||
|
||||
A cell can contain at most one hyperlink. If it does, it contains no other value.
|
||||
|
||||
Otherwise, it returns undef;
|
||||
|
||||
The array contains:
|
||||
|
||||
=over
|
||||
|
||||
=item * 0: Description (what's displayed); undef if not present
|
||||
|
||||
=item * 1: Link, converted to an appropriate URL - Note: Relative links are based on the input file. %REL% is used if the input file is unknown (e.g. a file handle or scalar)
|
||||
|
||||
=item * 2: Target - target frame (or undef if none)
|
||||
|
||||
=back
|
||||
|
||||
=head1 Dates and Time in Excel
|
||||
|
||||
Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 PM" is represented by the number 36892.521.
|
||||
|
||||
The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day.
|
||||
|
||||
A date or time in Excel is just like any other number. The way in which it is displayed is controlled by the number format:
|
||||
|
||||
Number format $cell->value() $cell->unformatted()
|
||||
============= ============== ==============
|
||||
'dd/mm/yy' '28/02/08' 39506.5
|
||||
'mm/dd/yy' '02/28/08' 39506.5
|
||||
'd-m-yyyy' '28-2-2008' 39506.5
|
||||
'dd/mm/yy hh:mm' '28/02/08 12:00' 39506.5
|
||||
'd mmm yyyy' '28 Feb 2008' 39506.5
|
||||
'mmm d yyyy hh:mm AM/PM' 'Feb 28 2008 12:00 PM' 39506.5
|
||||
|
||||
|
||||
The L<Spreadsheet::ParseExcel::Utility> module contains a function called C<ExcelLocaltime> which will convert between an unformatted Excel date/time number and a C<localtime()> like array.
|
||||
|
||||
For date conversions using the CPAN C<DateTime> framework see L<DateTime::Format::Excel> http://search.cpan.org/search?dist=DateTime-Format-Excel
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
360
database/perl/vendor/lib/Spreadsheet/ParseExcel/Dump.pm
vendored
Normal file
360
database/perl/vendor/lib/Spreadsheet/ParseExcel/Dump.pm
vendored
Normal file
@@ -0,0 +1,360 @@
|
||||
package Spreadsheet::ParseExcel::Dump;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::Dump - A class for dumping Excel records.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
my %NameTbl = (
|
||||
|
||||
#P291
|
||||
0x0A => 'EOF',
|
||||
0x0C => 'CALCCOUNT',
|
||||
0x0D => 'CALCMODE',
|
||||
0x0E => 'PRECISION',
|
||||
0x0F => 'REFMODE',
|
||||
0x10 => 'DELTA',
|
||||
0x11 => 'ITERATION',
|
||||
0x12 => 'PROTECT',
|
||||
0x13 => 'PASSWORD',
|
||||
0x14 => 'HEADER',
|
||||
|
||||
0x15 => 'FOOTER',
|
||||
0x16 => 'EXTERNCOUNT',
|
||||
0x17 => 'EXTERNSHEET',
|
||||
0x19 => 'WINDOWPROTECT',
|
||||
0x1A => 'VERTICALPAGEBREAKS',
|
||||
0x1B => 'HORIZONTALPAGEBREAKS',
|
||||
0x1C => 'NOTE',
|
||||
0x1D => 'SELECTION',
|
||||
0x22 => '1904',
|
||||
0x26 => 'LEFTMARGIN',
|
||||
|
||||
0x27 => 'RIGHTMARGIN',
|
||||
0x28 => 'TOPMARGIN',
|
||||
0x29 => 'BOTTOMMARGIN',
|
||||
0x2A => 'PRINTHEADERS',
|
||||
0x2B => 'PRINTGRIDLINES',
|
||||
0x2F => 'FILEPASS',
|
||||
0x3C => 'COUNTINUE',
|
||||
0x3D => 'WINDOW1',
|
||||
0x40 => 'BACKUP',
|
||||
0x41 => 'PANE',
|
||||
|
||||
0x42 => 'CODEPAGE',
|
||||
0x4D => 'PLS',
|
||||
0x50 => 'DCON',
|
||||
0x51 => 'DCONREF',
|
||||
|
||||
#P292
|
||||
0x52 => 'DCONNAME',
|
||||
0x55 => 'DEFCOLWIDTH',
|
||||
0x59 => 'XCT',
|
||||
0x5A => 'CRN',
|
||||
0x5B => 'FILESHARING',
|
||||
0x5C => 'WRITEACCES',
|
||||
0x5D => 'OBJ',
|
||||
0x5E => 'UNCALCED',
|
||||
0x5F => 'SAVERECALC',
|
||||
0x60 => 'TEMPLATE',
|
||||
|
||||
0x63 => 'OBJPROTECT',
|
||||
0x7D => 'COLINFO',
|
||||
0x7E => 'RK',
|
||||
0x7F => 'IMDATA',
|
||||
0x80 => 'GUTS',
|
||||
0x81 => 'WSBOOL',
|
||||
0x82 => 'GRIDSET',
|
||||
0x83 => 'HCENTER',
|
||||
0x84 => 'VCENTER',
|
||||
0x85 => 'BOUNDSHEET',
|
||||
|
||||
0x86 => 'WRITEPROT',
|
||||
0x87 => 'ADDIN',
|
||||
0x88 => 'EDG',
|
||||
0x89 => 'PUB',
|
||||
0x8C => 'COUNTRY',
|
||||
0x8D => 'HIDEOBJ',
|
||||
0x90 => 'SORT',
|
||||
0x91 => 'SUB',
|
||||
0x92 => 'PALETTE',
|
||||
0x94 => 'LHRECORD',
|
||||
|
||||
0x95 => 'LHNGRAPH',
|
||||
0x96 => 'SOUND',
|
||||
0x98 => 'LPR',
|
||||
0x99 => 'STANDARDWIDTH',
|
||||
0x9A => 'FNGROUPNAME',
|
||||
0x9B => 'FILTERMODE',
|
||||
0x9C => 'FNGROUPCOUNT',
|
||||
|
||||
#P293
|
||||
0x9D => 'AUTOFILTERINFO',
|
||||
0x9E => 'AUTOFILTER',
|
||||
0xA0 => 'SCL',
|
||||
0xA1 => 'SETUP',
|
||||
0xA9 => 'COORDLIST',
|
||||
0xAB => 'GCW',
|
||||
0xAE => 'SCENMAN',
|
||||
0xAF => 'SCENARIO',
|
||||
0xB0 => 'SXVIEW',
|
||||
0xB1 => 'SXVD',
|
||||
|
||||
0xB2 => 'SXV',
|
||||
0xB4 => 'SXIVD',
|
||||
0xB5 => 'SXLI',
|
||||
0xB6 => 'SXPI',
|
||||
0xB8 => 'DOCROUTE',
|
||||
0xB9 => 'RECIPNAME',
|
||||
0xBC => 'SHRFMLA',
|
||||
0xBD => 'MULRK',
|
||||
0xBE => 'MULBLANK',
|
||||
0xBF => 'TOOLBARHDR',
|
||||
0xC0 => 'TOOLBAREND',
|
||||
0xC1 => 'MMS',
|
||||
|
||||
0xC2 => 'ADDMENU',
|
||||
0xC3 => 'DELMENU',
|
||||
0xC5 => 'SXDI',
|
||||
0xC6 => 'SXDB',
|
||||
0xCD => 'SXSTRING',
|
||||
0xD0 => 'SXTBL',
|
||||
0xD1 => 'SXTBRGIITM',
|
||||
0xD2 => 'SXTBPG',
|
||||
0xD3 => 'OBPROJ',
|
||||
0xD5 => 'SXISDTM',
|
||||
|
||||
0xD6 => 'RSTRING',
|
||||
0xD7 => 'DBCELL',
|
||||
0xDA => 'BOOKBOOL',
|
||||
0xDC => 'PARAMQRY',
|
||||
0xDC => 'SXEXT',
|
||||
0xDD => 'SCENPROTECT',
|
||||
0xDE => 'OLESIZE',
|
||||
|
||||
#P294
|
||||
0xDF => 'UDDESC',
|
||||
0xE0 => 'XF',
|
||||
0xE1 => 'INTERFACEHDR',
|
||||
0xE2 => 'INTERFACEEND',
|
||||
0xE3 => 'SXVS',
|
||||
0xEA => 'TABIDCONF',
|
||||
0xEB => 'MSODRAWINGGROUP',
|
||||
0xEC => 'MSODRAWING',
|
||||
0xED => 'MSODRAWINGSELECTION',
|
||||
0xEF => 'PHONETICINFO',
|
||||
0xF0 => 'SXRULE',
|
||||
|
||||
0xF1 => 'SXEXT',
|
||||
0xF2 => 'SXFILT',
|
||||
0xF6 => 'SXNAME',
|
||||
0xF7 => 'SXSELECT',
|
||||
0xF8 => 'SXPAIR',
|
||||
0xF9 => 'SXFMLA',
|
||||
0xFB => 'SXFORMAT',
|
||||
0xFC => 'SST',
|
||||
0xFD => 'LABELSST',
|
||||
0xFF => 'EXTSST',
|
||||
|
||||
0x100 => 'SXVDEX',
|
||||
0x103 => 'SXFORMULA',
|
||||
0x122 => 'SXDBEX',
|
||||
0x13D => 'TABID',
|
||||
0x160 => 'USESELFS',
|
||||
0x161 => 'DSF',
|
||||
0x162 => 'XL5MODIFY',
|
||||
0x1A5 => 'FILESHARING2',
|
||||
0x1A9 => 'USERBVIEW',
|
||||
0x1AA => 'USERVIEWBEGIN',
|
||||
|
||||
0x1AB => 'USERSVIEWEND',
|
||||
0x1AD => 'QSI',
|
||||
0x1AE => 'SUPBOOK',
|
||||
0x1AF => 'PROT4REV',
|
||||
0x1B0 => 'CONDFMT',
|
||||
0x1B1 => 'CF',
|
||||
0x1B2 => 'DVAL',
|
||||
|
||||
#P295
|
||||
0x1B5 => 'DCONBIN',
|
||||
0x1B6 => 'TXO',
|
||||
0x1B7 => 'REFRESHALL',
|
||||
0x1B8 => 'HLINK',
|
||||
0x1BA => 'CODENAME',
|
||||
0x1BB => 'SXFDBTYPE',
|
||||
0x1BC => 'PROT4REVPASS',
|
||||
0x1BE => 'DV',
|
||||
0x200 => 'DIMENSIONS',
|
||||
0x201 => 'BLANK',
|
||||
|
||||
0x202 => 'Integer', #Not Documented
|
||||
0x203 => 'NUMBER',
|
||||
0x204 => 'LABEL',
|
||||
0x205 => 'BOOLERR',
|
||||
0x207 => 'STRING',
|
||||
0x208 => 'ROW',
|
||||
0x20B => 'INDEX',
|
||||
0x218 => 'NAME',
|
||||
0x221 => 'ARRAY',
|
||||
0x223 => 'EXTERNNAME',
|
||||
0x225 => 'DEFAULTROWHEIGHT',
|
||||
|
||||
0x231 => 'FONT',
|
||||
0x236 => 'TABLE',
|
||||
0x23E => 'WINDOW2',
|
||||
0x293 => 'STYLE',
|
||||
0x406 => 'FORMULA',
|
||||
0x41E => 'FORMAT',
|
||||
|
||||
0x18 => 'NAME',
|
||||
|
||||
0x06 => 'FORMULA',
|
||||
|
||||
0x09 => 'BOF(BIFF2)',
|
||||
0x209 => 'BOF(BIFF3)',
|
||||
0x409 => 'BOF(BIFF4)',
|
||||
0x809 => 'BOF(BIFF5-7)',
|
||||
|
||||
0x31 => 'FONT', 0x27E => 'RK',
|
||||
|
||||
#Chart/Graph
|
||||
0x1001 => 'UNITS',
|
||||
0x1002 => 'CHART',
|
||||
0x1003 => 'SERISES',
|
||||
0x1006 => 'DATAFORMAT',
|
||||
0x1007 => 'LINEFORMAT',
|
||||
0x1009 => 'MAKERFORMAT',
|
||||
0x100A => 'AREAFORMAT',
|
||||
0x100B => 'PIEFORMAT',
|
||||
0x100C => 'ATTACHEDLABEL',
|
||||
0x100D => 'SERIESTEXT',
|
||||
0x1014 => 'CHARTFORMAT',
|
||||
0x1015 => 'LEGEND',
|
||||
0x1016 => 'SERIESLIST',
|
||||
0x1017 => 'BAR',
|
||||
0x1018 => 'LINE',
|
||||
0x1019 => 'PIE',
|
||||
0x101A => 'AREA',
|
||||
0x101B => 'SCATTER',
|
||||
0x101C => 'CHARTLINE',
|
||||
0x101D => 'AXIS',
|
||||
0x101E => 'TICK',
|
||||
0x101F => 'VALUERANGE',
|
||||
0x1020 => 'CATSERRANGE',
|
||||
0x1021 => 'AXISLINEFORMAT',
|
||||
0x1022 => 'CHARTFORMATLINK',
|
||||
0x1024 => 'DEFAULTTEXT',
|
||||
0x1025 => 'TEXT',
|
||||
0x1026 => 'FONTX',
|
||||
0x1027 => 'OBJECTLINK',
|
||||
0x1032 => 'FRAME',
|
||||
0x1033 => 'BEGIN',
|
||||
0x1034 => 'END',
|
||||
0x1035 => 'PLOTAREA',
|
||||
0x103A => '3D',
|
||||
0x103C => 'PICF',
|
||||
0x103D => 'DROPBAR',
|
||||
0x103E => 'RADAR',
|
||||
0x103F => 'SURFACE',
|
||||
0x1040 => 'RADARAREA',
|
||||
0x1041 => 'AXISPARENT',
|
||||
0x1043 => 'LEGENDXN',
|
||||
0x1044 => 'SHTPROPS',
|
||||
0x1045 => 'SERTOCRT',
|
||||
0x1046 => 'AXESUSED',
|
||||
0x1048 => 'SBASEREF',
|
||||
0x104A => 'SERPARENT',
|
||||
0x104B => 'SERAUXTREND',
|
||||
0x104E => 'IFMT',
|
||||
0x104F => 'POS',
|
||||
0x1050 => 'ALRUNS',
|
||||
0x1051 => 'AI',
|
||||
0x105B => 'SERAUXERRBAR',
|
||||
0x105D => 'SERFMT',
|
||||
0x1060 => 'FBI',
|
||||
0x1061 => 'BOPPOP',
|
||||
0x1062 => 'AXCEXT',
|
||||
0x1063 => 'DAT',
|
||||
0x1064 => 'PLOTGROWTH',
|
||||
0x1065 => 'SINDEX',
|
||||
0x1066 => 'GELFRAME',
|
||||
0x1067 => 'BPOPPOPCUSTOM',
|
||||
);
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# subDUMP (for Spreadsheet::ParseExcel)
|
||||
#------------------------------------------------------------------------------
|
||||
sub subDUMP {
|
||||
my ( $oBook, $bOp, $bLen, $sWk ) = @_;
|
||||
printf "%04X:%-23s (Len:%3d) : %s\n",
|
||||
$bOp, OpName($bOp), $bLen, unpack( "H40", $sWk );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Spreadsheet::ParseExcel->OpName
|
||||
#------------------------------------------------------------------------------
|
||||
sub OpName {
|
||||
my ($bOp) = @_;
|
||||
return ( defined $NameTbl{$bOp} ) ? $NameTbl{$bOp} : 'undef';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::Dump - A class for dumping Excel records.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
|
||||
226
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtDefault.pm
vendored
Normal file
226
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtDefault.pm
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
package Spreadsheet::ParseExcel::FmtDefault;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::FmtDefault - A class for Cell formats.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Spreadsheet::ParseExcel::Utility qw(ExcelFmt);
|
||||
our $VERSION = '0.65';
|
||||
|
||||
my %hFmtDefault = (
|
||||
0x00 => 'General',
|
||||
0x01 => '0',
|
||||
0x02 => '0.00',
|
||||
0x03 => '#,##0',
|
||||
0x04 => '#,##0.00',
|
||||
0x05 => '($#,##0_);($#,##0)',
|
||||
0x06 => '($#,##0_);[Red]($#,##0)',
|
||||
0x07 => '($#,##0.00_);($#,##0.00_)',
|
||||
0x08 => '($#,##0.00_);[Red]($#,##0.00_)',
|
||||
0x09 => '0%',
|
||||
0x0A => '0.00%',
|
||||
0x0B => '0.00E+00',
|
||||
0x0C => '# ?/?',
|
||||
0x0D => '# ??/??',
|
||||
0x0E => 'yyyy-mm-dd', # Was 'm-d-yy', which is bad as system default
|
||||
0x0F => 'd-mmm-yy',
|
||||
0x10 => 'd-mmm',
|
||||
0x11 => 'mmm-yy',
|
||||
0x12 => 'h:mm AM/PM',
|
||||
0x13 => 'h:mm:ss AM/PM',
|
||||
0x14 => 'h:mm',
|
||||
0x15 => 'h:mm:ss',
|
||||
0x16 => 'm-d-yy h:mm',
|
||||
|
||||
#0x17-0x24 -- Differs in Natinal
|
||||
0x25 => '(#,##0_);(#,##0)',
|
||||
0x26 => '(#,##0_);[Red](#,##0)',
|
||||
0x27 => '(#,##0.00);(#,##0.00)',
|
||||
0x28 => '(#,##0.00);[Red](#,##0.00)',
|
||||
0x29 => '_(*#,##0_);_(*(#,##0);_(*"-"_);_(@_)',
|
||||
0x2A => '_($*#,##0_);_($*(#,##0);_(*"-"_);_(@_)',
|
||||
0x2B => '_(*#,##0.00_);_(*(#,##0.00);_(*"-"??_);_(@_)',
|
||||
0x2C => '_($*#,##0.00_);_($*(#,##0.00);_(*"-"??_);_(@_)',
|
||||
0x2D => 'mm:ss',
|
||||
0x2E => '[h]:mm:ss',
|
||||
0x2F => 'mm:ss.0',
|
||||
0x30 => '##0.0E+0',
|
||||
0x31 => '@',
|
||||
);
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# new (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub new {
|
||||
my ( $sPkg, %hKey ) = @_;
|
||||
my $oThis = {};
|
||||
bless $oThis;
|
||||
return $oThis;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# TextFmt (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub TextFmt {
|
||||
my ( $oThis, $sTxt, $sCode ) = @_;
|
||||
return $sTxt if ( ( !defined($sCode) ) || ( $sCode eq '_native_' ) );
|
||||
return pack( 'U*', unpack( 'n*', $sTxt ) );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# FmtStringDef (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub FmtStringDef {
|
||||
my ( $oThis, $iFmtIdx, $oBook, $rhFmt ) = @_;
|
||||
my $sFmtStr = $oBook->{FormatStr}->{$iFmtIdx};
|
||||
|
||||
if ( !( defined($sFmtStr) ) && defined($rhFmt) ) {
|
||||
$sFmtStr = $rhFmt->{$iFmtIdx};
|
||||
}
|
||||
$sFmtStr = $hFmtDefault{$iFmtIdx} unless ($sFmtStr);
|
||||
return $sFmtStr;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# FmtString (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub FmtString {
|
||||
my ( $oThis, $oCell, $oBook ) = @_;
|
||||
|
||||
my $sFmtStr =
|
||||
$oThis->FmtStringDef( $oBook->{Format}[ $oCell->{FormatNo} ]->{FmtIdx},
|
||||
$oBook );
|
||||
|
||||
# Special case for cells that use Lotus123 style leading
|
||||
# apostrophe to designate text formatting.
|
||||
if ( $oBook->{Format}[ $oCell->{FormatNo} ]->{Key123} ) {
|
||||
$sFmtStr = '@';
|
||||
}
|
||||
|
||||
unless ( defined($sFmtStr) ) {
|
||||
if ( $oCell->{Type} eq 'Numeric' ) {
|
||||
if ( int( $oCell->{Val} ) != $oCell->{Val} ) {
|
||||
$sFmtStr = '0.00';
|
||||
}
|
||||
else {
|
||||
$sFmtStr = '0';
|
||||
}
|
||||
}
|
||||
elsif ( $oCell->{Type} eq 'Date' ) {
|
||||
if ( int( $oCell->{Val} ) <= 0 ) {
|
||||
$sFmtStr = 'h:mm:ss';
|
||||
}
|
||||
else {
|
||||
$sFmtStr = 'yyyy-mm-dd';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sFmtStr = '@';
|
||||
}
|
||||
}
|
||||
return $sFmtStr;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# ValFmt (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub ValFmt {
|
||||
my ( $oThis, $oCell, $oBook ) = @_;
|
||||
|
||||
my ( $Dt, $iFmtIdx, $iNumeric, $Flg1904 );
|
||||
|
||||
if ( $oCell->{Type} eq 'Text' ) {
|
||||
$Dt =
|
||||
( ( defined $oCell->{Val} ) && ( $oCell->{Val} ne '' ) )
|
||||
? $oThis->TextFmt( $oCell->{Val}, $oCell->{Code} )
|
||||
: '';
|
||||
|
||||
return $Dt;
|
||||
}
|
||||
else {
|
||||
$Dt = $oCell->{Val};
|
||||
$Flg1904 = $oBook->{Flg1904};
|
||||
my $sFmtStr = $oThis->FmtString( $oCell, $oBook );
|
||||
|
||||
return ExcelFmt( $sFmtStr, $Dt, $Flg1904, $oCell->{Type} );
|
||||
}
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# ChkType (for Spreadsheet::ParseExcel::FmtDefault)
|
||||
#------------------------------------------------------------------------------
|
||||
sub ChkType {
|
||||
my ( $oPkg, $iNumeric, $iFmtIdx ) = @_;
|
||||
if ($iNumeric) {
|
||||
if ( ( ( $iFmtIdx >= 0x0E ) && ( $iFmtIdx <= 0x16 ) )
|
||||
|| ( ( $iFmtIdx >= 0x2D ) && ( $iFmtIdx <= 0x2F ) ) )
|
||||
{
|
||||
return "Date";
|
||||
}
|
||||
else {
|
||||
return "Numeric";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "Text";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::FmtDefault - A class for Cell formats.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
215
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtJapan.pm
vendored
Normal file
215
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtJapan.pm
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
package Spreadsheet::ParseExcel::FmtJapan;
|
||||
use utf8;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::FmtJapan - A class for Cell formats.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Encode qw(find_encoding decode);
|
||||
use base 'Spreadsheet::ParseExcel::FmtDefault';
|
||||
our $VERSION = '0.65';
|
||||
|
||||
my %FormatTable = (
|
||||
0x00 => 'General',
|
||||
0x01 => '0',
|
||||
0x02 => '0.00',
|
||||
0x03 => '#,##0',
|
||||
0x04 => '#,##0.00',
|
||||
0x05 => '(\\#,##0_);(\\#,##0)',
|
||||
0x06 => '(\\#,##0_);[Red](\\#,##0)',
|
||||
0x07 => '(\\#,##0.00_);(\\#,##0.00_)',
|
||||
0x08 => '(\\#,##0.00_);[Red](\\#,##0.00_)',
|
||||
0x09 => '0%',
|
||||
0x0A => '0.00%',
|
||||
0x0B => '0.00E+00',
|
||||
0x0C => '# ?/?',
|
||||
0x0D => '# ??/??',
|
||||
|
||||
# 0x0E => 'm/d/yy',
|
||||
0x0E => 'yyyy/m/d',
|
||||
0x0F => 'd-mmm-yy',
|
||||
0x10 => 'd-mmm',
|
||||
0x11 => 'mmm-yy',
|
||||
0x12 => 'h:mm AM/PM',
|
||||
0x13 => 'h:mm:ss AM/PM',
|
||||
0x14 => 'h:mm',
|
||||
0x15 => 'h:mm:ss',
|
||||
|
||||
# 0x16 => 'm/d/yy h:mm',
|
||||
0x16 => 'yyyy/m/d h:mm',
|
||||
|
||||
#0x17-0x24 -- Differs in Natinal
|
||||
0x1E => 'm/d/yy',
|
||||
0x1F => 'yyyy"年"m"月"d"日"',
|
||||
0x20 => 'h"時"mm"分"',
|
||||
0x21 => 'h"時"mm"分"ss"秒"',
|
||||
|
||||
#0x17-0x24 -- Differs in Natinal
|
||||
0x25 => '(#,##0_);(#,##0)',
|
||||
0x26 => '(#,##0_);[Red](#,##0)',
|
||||
0x27 => '(#,##0.00);(#,##0.00)',
|
||||
0x28 => '(#,##0.00);[Red](#,##0.00)',
|
||||
0x29 => '_(*#,##0_);_(*(#,##0);_(*"-"_);_(@_)',
|
||||
0x2A => '_(\\*#,##0_);_(\\*(#,##0);_(*"-"_);_(@_)',
|
||||
0x2B => '_(*#,##0.00_);_(*(#,##0.00);_(*"-"??_);_(@_)',
|
||||
0x2C => '_(\\*#,##0.00_);_(\\*(#,##0.00);_(*"-"??_);_(@_)',
|
||||
0x2D => 'mm:ss',
|
||||
0x2E => '[h]:mm:ss',
|
||||
0x2F => 'mm:ss.0',
|
||||
0x30 => '##0.0E+0',
|
||||
0x31 => '@',
|
||||
|
||||
0x37 => 'yyyy"年"m"月"',
|
||||
0x38 => 'm"月"d"日"',
|
||||
0x39 => 'ge.m.d',
|
||||
0x3A => 'ggge"年"m"月"d"日"',
|
||||
);
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# new (for Spreadsheet::ParseExcel::FmtJapan)
|
||||
#------------------------------------------------------------------------------
|
||||
sub new {
|
||||
my ( $class, %args ) = @_;
|
||||
my $encoding = $args{Code} || $args{encoding};
|
||||
my $self = { Code => $encoding };
|
||||
if($encoding){
|
||||
$self->{encoding} = find_encoding($encoding eq 'sjis' ? 'cp932' : $encoding)
|
||||
or do{
|
||||
require Carp;
|
||||
Carp::croak(qq{Unknown encoding '$encoding'});
|
||||
};
|
||||
}
|
||||
return bless $self, $class;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# TextFmt (for Spreadsheet::ParseExcel::FmtJapan)
|
||||
#------------------------------------------------------------------------------
|
||||
sub TextFmt {
|
||||
my ( $self, $text, $input_encoding ) = @_;
|
||||
if(!defined $input_encoding){
|
||||
$input_encoding = 'utf8';
|
||||
}
|
||||
elsif($input_encoding eq '_native_'){
|
||||
$input_encoding = 'cp932'; # Shift_JIS in Microsoft products
|
||||
}
|
||||
$text = decode($input_encoding, $text);
|
||||
return $self->{Code} ? $self->{encoding}->encode($text) : $text;
|
||||
}
|
||||
#------------------------------------------------------------------------------
|
||||
# FmtStringDef (for Spreadsheet::ParseExcel::FmtJapan)
|
||||
#------------------------------------------------------------------------------
|
||||
sub FmtStringDef {
|
||||
my ( $self, $format_index, $book ) = @_;
|
||||
return $self->SUPER::FmtStringDef( $format_index, $book, \%FormatTable );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# CnvNengo (for Spreadsheet::ParseExcel::FmtJapan)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Convert A.D. into Japanese Nengo (aka Gengo)
|
||||
|
||||
my @Nengo = (
|
||||
{
|
||||
name => '平成', # Heisei
|
||||
abbr_name => 'H',
|
||||
|
||||
base => 1988,
|
||||
start => 19890108,
|
||||
},
|
||||
{
|
||||
name => '昭和', # Showa
|
||||
abbr_name => 'S',
|
||||
|
||||
base => 1925,
|
||||
start => 19261225,
|
||||
},
|
||||
{
|
||||
name => '大正', # Taisho
|
||||
abbr_name => 'T',
|
||||
|
||||
base => 1911,
|
||||
start => 19120730,
|
||||
},
|
||||
{
|
||||
name => '明治', # Meiji
|
||||
abbr_name => 'M',
|
||||
|
||||
base => 1867,
|
||||
start => 18680908,
|
||||
},
|
||||
);
|
||||
|
||||
# Usage: CnvNengo(name => @tm) or CnvNeng(abbr_name => @tm)
|
||||
sub CnvNengo {
|
||||
my ( $kind, @tm ) = @_;
|
||||
my $year = $tm[5] + 1900;
|
||||
my $wk = ($year * 10000) + ($tm[4] * 100) + ($tm[3] * 1);
|
||||
#my $wk = sprintf( '%04d%02d%02d', $year, $tm[4], $tm[3] );
|
||||
foreach my $nengo(@Nengo){
|
||||
if( $wk >= $nengo->{start} ){
|
||||
return $nengo->{$kind} . ($year - $nengo->{base});
|
||||
}
|
||||
}
|
||||
return $year;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::FmtJapan - A class for Cell formats.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
108
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtJapan2.pm
vendored
Normal file
108
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtJapan2.pm
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
package Spreadsheet::ParseExcel::FmtJapan2;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::FmtJapan2 - A class for Cell formats.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Jcode;
|
||||
use Unicode::Map;
|
||||
use base 'Spreadsheet::ParseExcel::FmtJapan';
|
||||
our $VERSION = '0.65';
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# new (for Spreadsheet::ParseExcel::FmtJapan2)
|
||||
#------------------------------------------------------------------------------
|
||||
sub new {
|
||||
my ( $sPkg, %hKey ) = @_;
|
||||
my $oMap = Unicode::Map->new('CP932Excel');
|
||||
die "NO MAP FILE CP932Excel!!"
|
||||
unless ( -r Unicode::Map->mapping("CP932Excel") );
|
||||
|
||||
my $oThis = {
|
||||
Code => $hKey{Code},
|
||||
_UniMap => $oMap,
|
||||
};
|
||||
bless $oThis;
|
||||
$oThis->SUPER::new(%hKey);
|
||||
return $oThis;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# TextFmt (for Spreadsheet::ParseExcel::FmtJapan2)
|
||||
#------------------------------------------------------------------------------
|
||||
sub TextFmt {
|
||||
my ( $oThis, $sTxt, $sCode ) = @_;
|
||||
|
||||
# $sCode = 'sjis' if((! defined($sCode)) || ($sCode eq '_native_'));
|
||||
if ( $oThis->{Code} ) {
|
||||
if ( !defined($sCode) ) {
|
||||
$sTxt =~ s/(.)/\x00$1/sg;
|
||||
$sTxt = $oThis->{_UniMap}->from_unicode($sTxt);
|
||||
}
|
||||
elsif ( $sCode eq 'ucs2' ) {
|
||||
$sTxt = $oThis->{_UniMap}->from_unicode($sTxt);
|
||||
}
|
||||
return Jcode::convert( $sTxt, $oThis->{Code}, 'sjis' );
|
||||
}
|
||||
else {
|
||||
return $sTxt;
|
||||
}
|
||||
}
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::FmtJapan2 - A class for Cell formats.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
109
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtUnicode.pm
vendored
Normal file
109
database/perl/vendor/lib/Spreadsheet/ParseExcel/FmtUnicode.pm
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
package Spreadsheet::ParseExcel::FmtUnicode;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::FmtUnicode - A class for Cell formats.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Unicode::Map;
|
||||
use base 'Spreadsheet::ParseExcel::FmtDefault';
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# new (for Spreadsheet::ParseExcel::FmtUnicode)
|
||||
#------------------------------------------------------------------------------
|
||||
sub new {
|
||||
my ( $sPkg, %hKey ) = @_;
|
||||
my $sMap = $hKey{Unicode_Map};
|
||||
my $oMap;
|
||||
$oMap = Unicode::Map->new($sMap) if $sMap;
|
||||
my $oThis = {
|
||||
Unicode_Map => $sMap,
|
||||
_UniMap => $oMap,
|
||||
};
|
||||
bless $oThis;
|
||||
return $oThis;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# TextFmt (for Spreadsheet::ParseExcel::FmtUnicode)
|
||||
#------------------------------------------------------------------------------
|
||||
sub TextFmt {
|
||||
my ( $oThis, $sTxt, $sCode ) = @_;
|
||||
if ( $oThis->{_UniMap} ) {
|
||||
if ( !defined($sCode) ) {
|
||||
my $sSv = $sTxt;
|
||||
$sTxt =~ s/(.)/\x00$1/sg;
|
||||
$sTxt = $oThis->{_UniMap}->from_unicode($sTxt);
|
||||
$sTxt = $sSv unless ($sTxt);
|
||||
}
|
||||
elsif ( $sCode eq 'ucs2' ) {
|
||||
$sTxt = $oThis->{_UniMap}->from_unicode($sTxt);
|
||||
}
|
||||
|
||||
# $sTxt = $oThis->{_UniMap}->from_unicode($sTxt)
|
||||
# if(defined($sCode) && $sCode eq 'ucs2');
|
||||
return $sTxt;
|
||||
}
|
||||
else {
|
||||
return $sTxt;
|
||||
}
|
||||
}
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::FmtUnicode - A class for Cell formats.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
74
database/perl/vendor/lib/Spreadsheet/ParseExcel/Font.pm
vendored
Normal file
74
database/perl/vendor/lib/Spreadsheet/ParseExcel/Font.pm
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
package Spreadsheet::ParseExcel::Font;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::Font - A class for Cell fonts.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
sub new {
|
||||
my ( $class, %rhIni ) = @_;
|
||||
my $self = \%rhIni;
|
||||
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::Font - A class for Cell fonts.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
|
||||
73
database/perl/vendor/lib/Spreadsheet/ParseExcel/Format.pm
vendored
Normal file
73
database/perl/vendor/lib/Spreadsheet/ParseExcel/Format.pm
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
package Spreadsheet::ParseExcel::Format;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::Format - A class for Cell formats.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
sub new {
|
||||
my ( $class, %rhIni ) = @_;
|
||||
my $self = \%rhIni;
|
||||
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::Format - A class for Cell formats.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
315
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser.pm
vendored
Normal file
315
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser.pm
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
package Spreadsheet::ParseExcel::SaveParser;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::SaveParser - Rewrite an existing Excel file.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Spreadsheet::ParseExcel;
|
||||
use Spreadsheet::ParseExcel::SaveParser::Workbook;
|
||||
use Spreadsheet::ParseExcel::SaveParser::Worksheet;
|
||||
use Spreadsheet::WriteExcel;
|
||||
use base 'Spreadsheet::ParseExcel';
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# new()
|
||||
#
|
||||
sub new {
|
||||
|
||||
my ( $package, %params ) = @_;
|
||||
$package->SUPER::new(%params);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Create()
|
||||
#
|
||||
sub Create {
|
||||
|
||||
my ( $self, $formatter ) = @_;
|
||||
|
||||
#0. New $workbook
|
||||
my $workbook = Spreadsheet::ParseExcel::Workbook->new();
|
||||
$workbook->{SheetCount} = 0;
|
||||
|
||||
# User specified formatter class.
|
||||
if ($formatter) {
|
||||
$workbook->{FmtClass} = $formatter;
|
||||
}
|
||||
else {
|
||||
$workbook->{FmtClass} = Spreadsheet::ParseExcel::FmtDefault->new();
|
||||
}
|
||||
|
||||
return Spreadsheet::ParseExcel::SaveParser::Workbook->new($workbook);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Parse()
|
||||
#
|
||||
sub Parse {
|
||||
|
||||
my ( $self, $sFile, $formatter ) = @_;
|
||||
|
||||
my $workbook = $self->SUPER::Parse( $sFile, $formatter );
|
||||
|
||||
return undef unless defined $workbook;
|
||||
return Spreadsheet::ParseExcel::SaveParser::Workbook->new($workbook);
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# SaveAs()
|
||||
#
|
||||
sub SaveAs {
|
||||
|
||||
my ( $self, $workbook, $filename ) = @_;
|
||||
|
||||
$workbook->SaveAs($filename);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::SaveParser - Rewrite an existing Excel file.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
||||
|
||||
Say we start with an Excel file that looks like this:
|
||||
|
||||
-----------------------------------------------------
|
||||
| | A | B | C |
|
||||
-----------------------------------------------------
|
||||
| 1 | Hello | ... | ... | ...
|
||||
| 2 | World | ... | ... | ...
|
||||
| 3 | *Bold text* | ... | ... | ...
|
||||
| 4 | ... | ... | ... | ...
|
||||
| 5 | ... | ... | ... | ...
|
||||
|
||||
|
||||
Then we process it with the following program:
|
||||
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Spreadsheet::ParseExcel;
|
||||
use Spreadsheet::ParseExcel::SaveParser;
|
||||
|
||||
|
||||
# Open an existing file with SaveParser
|
||||
my $parser = Spreadsheet::ParseExcel::SaveParser->new();
|
||||
my $template = $parser->Parse('template.xls');
|
||||
|
||||
|
||||
# Get the first worksheet.
|
||||
my $worksheet = $template->worksheet(0);
|
||||
my $row = 0;
|
||||
my $col = 0;
|
||||
|
||||
|
||||
# Overwrite the string in cell A1
|
||||
$worksheet->AddCell( $row, $col, 'New string' );
|
||||
|
||||
|
||||
# Add a new string in cell B1
|
||||
$worksheet->AddCell( $row, $col + 1, 'Newer' );
|
||||
|
||||
|
||||
# Add a new string in cell C1 with the format from cell A3.
|
||||
my $cell = $worksheet->get_cell( $row + 2, $col );
|
||||
my $format_number = $cell->{FormatNo};
|
||||
|
||||
$worksheet->AddCell( $row, $col + 2, 'Newest', $format_number );
|
||||
|
||||
|
||||
# Write over the existing file or write a new file.
|
||||
$template->SaveAs('newfile.xls');
|
||||
|
||||
|
||||
We should now have an Excel file that looks like this:
|
||||
|
||||
-----------------------------------------------------
|
||||
| | A | B | C |
|
||||
-----------------------------------------------------
|
||||
| 1 | New string | Newer | *Newest* | ...
|
||||
| 2 | World | ... | ... | ...
|
||||
| 3 | *Bold text* | ... | ... | ...
|
||||
| 4 | ... | ... | ... | ...
|
||||
| 5 | ... | ... | ... | ...
|
||||
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The C<Spreadsheet::ParseExcel::SaveParser> module rewrite an existing Excel file by reading it with C<Spreadsheet::ParseExcel> and rewriting it with C<Spreadsheet::WriteExcel>.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head1 Parser
|
||||
|
||||
=head2 new()
|
||||
|
||||
$parse = new Spreadsheet::ParseExcel::SaveParser();
|
||||
|
||||
Constructor.
|
||||
|
||||
=head2 Parse()
|
||||
|
||||
$workbook = $parse->Parse($sFileName);
|
||||
|
||||
$workbook = $parse->Parse($sFileName , $formatter);
|
||||
|
||||
Returns a L</Workbook> object. If an error occurs, returns undef.
|
||||
|
||||
The optional C<$formatter> is a Formatter Class to format the value of cells.
|
||||
|
||||
|
||||
=head1 Workbook
|
||||
|
||||
The C<Parse()> method returns a C<Spreadsheet::ParseExcel::SaveParser::Workbook> object.
|
||||
|
||||
This is a subclass of the L<Spreadsheet::ParseExcel::Workbook> and has the following methods:
|
||||
|
||||
=head2 worksheets()
|
||||
|
||||
Returns an array of L</Worksheet> objects. This was most commonly used to iterate over the worksheets in a workbook:
|
||||
|
||||
for my $worksheet ( $workbook->worksheets() ) {
|
||||
...
|
||||
}
|
||||
|
||||
=head2 worksheet()
|
||||
|
||||
The C<worksheet()> method returns a single C<Worksheet> object using either its name or index:
|
||||
|
||||
$worksheet = $workbook->worksheet('Sheet1');
|
||||
$worksheet = $workbook->worksheet(0);
|
||||
|
||||
Returns C<undef> if the sheet name or index doesn't exist.
|
||||
|
||||
|
||||
=head2 AddWorksheet()
|
||||
|
||||
$workbook = $workbook->AddWorksheet($name, %properties);
|
||||
|
||||
Create a new Worksheet object of type C<Spreadsheet::ParseExcel::Worksheet>.
|
||||
|
||||
The C<%properties> hash contains the properties of new Worksheet.
|
||||
|
||||
|
||||
=head2 AddFont
|
||||
|
||||
$workbook = $workbook->AddFont(%properties);
|
||||
|
||||
Create new Font object of type C<Spreadsheet::ParseExcel::Font>.
|
||||
|
||||
The C<%properties> hash contains the properties of new Font.
|
||||
|
||||
|
||||
=head2 AddFormat
|
||||
|
||||
$workbook = $workbook->AddFormat(%properties);
|
||||
|
||||
The C<%properties> hash contains the properties of new Font.
|
||||
|
||||
|
||||
=head1 Worksheet
|
||||
|
||||
Spreadsheet::ParseExcel::SaveParser::Worksheet
|
||||
|
||||
Worksheet is a subclass of Spreadsheet::ParseExcel::Worksheet.
|
||||
And has these methods :
|
||||
|
||||
|
||||
The C<Worksbook::worksheet()> method returns a C<Spreadsheet::ParseExcel::SaveParser::Worksheet> object.
|
||||
|
||||
This is a subclass of the L<Spreadsheet::ParseExcel::Worksheet> and has the following methods:
|
||||
|
||||
|
||||
=head1 AddCell
|
||||
|
||||
$workbook = $worksheet->AddCell($row, $col, $value, $format [$encoding]);
|
||||
|
||||
Create new Cell object of type C<Spreadsheet::ParseExcel::Cell>.
|
||||
|
||||
The C<$format> parameter is the format number rather than a full format object.
|
||||
|
||||
To specify just same as another cell,
|
||||
you can set it like below:
|
||||
|
||||
$row = 0;
|
||||
$col = 0;
|
||||
$worksheet = $template->worksheet(0);
|
||||
$cell = $worksheet->get_cell( $row, $col );
|
||||
$format_number = $cell->{FormatNo};
|
||||
|
||||
$worksheet->AddCell($row +1, $coll, 'New data', $format_number);
|
||||
|
||||
|
||||
|
||||
|
||||
=head1 TODO
|
||||
|
||||
Please note that this module is currently (versions 0.50-0.60) undergoing a major
|
||||
restructuring and rewriting.
|
||||
|
||||
=head1 Known Problems
|
||||
|
||||
|
||||
You can only rewrite the features that Spreadsheet::WriteExcel supports so
|
||||
macros, graphs and some other features in the original Excel file will be lost.
|
||||
Also, formulas aren't rewritten, only the result of a formula is written.
|
||||
|
||||
Only last print area will remain. (Others will be removed)
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2002 Kawai Takanori and Nippon-RAD Co. OP Division
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
|
||||
=cut
|
||||
462
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser/Workbook.pm
vendored
Normal file
462
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser/Workbook.pm
vendored
Normal file
@@ -0,0 +1,462 @@
|
||||
package Spreadsheet::ParseExcel::SaveParser::Workbook;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::SaveParser::Workbook - A class for SaveParser Workbooks.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'Spreadsheet::ParseExcel::Workbook';
|
||||
our $VERSION = '0.65';
|
||||
|
||||
#==============================================================================
|
||||
# Spreadsheet::ParseExcel::SaveParser::Workbook
|
||||
#==============================================================================
|
||||
|
||||
sub new {
|
||||
my ( $sPkg, $oBook ) = @_;
|
||||
return undef unless ( defined $oBook );
|
||||
my %oThis = %$oBook;
|
||||
bless \%oThis, $sPkg;
|
||||
|
||||
# re-bless worksheets (and set their _Book properties !!!)
|
||||
my $sWkP = ref($sPkg) || "$sPkg";
|
||||
$sWkP =~ s/Workbook$/Worksheet/;
|
||||
map { bless( $_, $sWkP ); } @{ $oThis{Worksheet} };
|
||||
map { $_->{_Book} = \%oThis; } @{ $oThis{Worksheet} };
|
||||
return \%oThis;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Parse (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub Parse {
|
||||
my ( $sClass, $sFile, $oWkFmt ) = @_;
|
||||
my $oBook = Spreadsheet::ParseExcel::Workbook->Parse( $sFile, $oWkFmt );
|
||||
bless $oBook, $sClass;
|
||||
|
||||
# re-bless worksheets (and set their _Book properties !!!)
|
||||
my $sWkP = ref($sClass) || "$sClass";
|
||||
$sWkP =~ s/Workbook$/Worksheet/;
|
||||
map { bless( $_, $sWkP ); } @{ $oBook->{Worksheet} };
|
||||
map { $_->{_Book} = $oBook; } @{ $oBook->{Worksheet} };
|
||||
return $oBook;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# SaveAs (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub SaveAs {
|
||||
my ( $oBook, $sName ) = @_;
|
||||
|
||||
# Create a new Excel workbook
|
||||
my $oWrEx = Spreadsheet::WriteExcel->new($sName);
|
||||
$oWrEx->compatibility_mode();
|
||||
my %hFmt;
|
||||
|
||||
my $iNo = 0;
|
||||
my @aAlH = (
|
||||
'left', 'left', 'center', 'right',
|
||||
'fill', 'justify', 'merge', 'equal_space'
|
||||
);
|
||||
my @aAlV = ( 'top', 'vcenter', 'bottom', 'vjustify', 'vequal_space' );
|
||||
|
||||
foreach my $pFmt ( @{ $oBook->{Format} } ) {
|
||||
my $oFmt = $oWrEx->addformat(); # Add Formats
|
||||
unless ( $pFmt->{Style} ) {
|
||||
$hFmt{$iNo} = $oFmt;
|
||||
my $rFont = $pFmt->{Font};
|
||||
|
||||
$oFmt->set_font( $rFont->{Name} );
|
||||
$oFmt->set_size( $rFont->{Height} );
|
||||
$oFmt->set_color( $rFont->{Color} );
|
||||
$oFmt->set_bold( $rFont->{Bold} );
|
||||
$oFmt->set_italic( $rFont->{Italic} );
|
||||
$oFmt->set_underline( $rFont->{Underline} );
|
||||
$oFmt->set_font_strikeout( $rFont->{Strikeout} );
|
||||
$oFmt->set_font_script( $rFont->{Super} );
|
||||
|
||||
$oFmt->set_hidden( $rFont->{Hidden} ); #Add
|
||||
|
||||
$oFmt->set_locked( $pFmt->{Lock} );
|
||||
|
||||
$oFmt->set_align( $aAlH[ $pFmt->{AlignH} ] );
|
||||
$oFmt->set_align( $aAlV[ $pFmt->{AlignV} ] );
|
||||
|
||||
$oFmt->set_rotation( $pFmt->{Rotate} );
|
||||
|
||||
$oFmt->set_num_format(
|
||||
$oBook->{FmtClass}->FmtStringDef( $pFmt->{FmtIdx}, $oBook ) );
|
||||
|
||||
$oFmt->set_text_wrap( $pFmt->{Wrap} );
|
||||
|
||||
$oFmt->set_pattern( $pFmt->{Fill}->[0] );
|
||||
$oFmt->set_fg_color( $pFmt->{Fill}->[1] )
|
||||
if ( ( $pFmt->{Fill}->[1] >= 8 )
|
||||
&& ( $pFmt->{Fill}->[1] <= 63 ) );
|
||||
$oFmt->set_bg_color( $pFmt->{Fill}->[2] )
|
||||
if ( ( $pFmt->{Fill}->[2] >= 8 )
|
||||
&& ( $pFmt->{Fill}->[2] <= 63 ) );
|
||||
|
||||
$oFmt->set_left(
|
||||
( $pFmt->{BdrStyle}->[0] > 7 ) ? 3 : $pFmt->{BdrStyle}->[0] );
|
||||
$oFmt->set_right(
|
||||
( $pFmt->{BdrStyle}->[1] > 7 ) ? 3 : $pFmt->{BdrStyle}->[1] );
|
||||
$oFmt->set_top(
|
||||
( $pFmt->{BdrStyle}->[2] > 7 ) ? 3 : $pFmt->{BdrStyle}->[2] );
|
||||
$oFmt->set_bottom(
|
||||
( $pFmt->{BdrStyle}->[3] > 7 ) ? 3 : $pFmt->{BdrStyle}->[3] );
|
||||
|
||||
$oFmt->set_left_color( $pFmt->{BdrColor}->[0] )
|
||||
if ( ( $pFmt->{BdrColor}->[0] >= 8 )
|
||||
&& ( $pFmt->{BdrColor}->[0] <= 63 ) );
|
||||
$oFmt->set_right_color( $pFmt->{BdrColor}->[1] )
|
||||
if ( ( $pFmt->{BdrColor}->[1] >= 8 )
|
||||
&& ( $pFmt->{BdrColor}->[1] <= 63 ) );
|
||||
$oFmt->set_top_color( $pFmt->{BdrColor}->[2] )
|
||||
if ( ( $pFmt->{BdrColor}->[2] >= 8 )
|
||||
&& ( $pFmt->{BdrColor}->[2] <= 63 ) );
|
||||
$oFmt->set_bottom_color( $pFmt->{BdrColor}->[3] )
|
||||
if ( ( $pFmt->{BdrColor}->[3] >= 8 )
|
||||
&& ( $pFmt->{BdrColor}->[3] <= 63 ) );
|
||||
}
|
||||
$iNo++;
|
||||
}
|
||||
for ( my $iSheet = 0 ; $iSheet < $oBook->{SheetCount} ; $iSheet++ ) {
|
||||
my $oWkS = $oBook->{Worksheet}[$iSheet];
|
||||
my $oWrS = $oWrEx->addworksheet( $oWkS->{Name} );
|
||||
|
||||
#Landscape
|
||||
if ( !$oWkS->{Landscape} ) { # Landscape (0:Horizontal, 1:Vertical)
|
||||
$oWrS->set_landscape();
|
||||
}
|
||||
else {
|
||||
$oWrS->set_portrait();
|
||||
}
|
||||
|
||||
#Protect
|
||||
if ( defined $oWkS->{Protect} )
|
||||
{ # Protect ('':NoPassword, Password:Password)
|
||||
if ( $oWkS->{Protect} ne '' ) {
|
||||
$oWrS->protect( $oWkS->{Protect} );
|
||||
}
|
||||
else {
|
||||
$oWrS->protect();
|
||||
}
|
||||
}
|
||||
if ( $oWkS->{Scale} != 100 ) {
|
||||
|
||||
# Pages on fit with width and Heigt
|
||||
$oWrS->fit_to_pages( $oWkS->{FitWidth}, $oWkS->{FitHeight} );
|
||||
|
||||
#Print Scale and reset FitWidth/FitHeight
|
||||
$oWrS->set_print_scale( $oWkS->{Scale} );
|
||||
}
|
||||
else {
|
||||
|
||||
#Print Scale
|
||||
$oWrS->set_print_scale( $oWkS->{Scale} );
|
||||
|
||||
# Pages on fit with width and Heigt
|
||||
$oWrS->fit_to_pages( $oWkS->{FitWidth}, $oWkS->{FitHeight} );
|
||||
}
|
||||
|
||||
# Paper Size
|
||||
$oWrS->set_paper( $oWkS->{PaperSize} );
|
||||
|
||||
# Margin
|
||||
$oWrS->set_margin_left( $oWkS->{LeftMargin} );
|
||||
$oWrS->set_margin_right( $oWkS->{RightMargin} );
|
||||
$oWrS->set_margin_top( $oWkS->{TopMargin} );
|
||||
$oWrS->set_margin_bottom( $oWkS->{BottomMargin} );
|
||||
|
||||
# HCenter
|
||||
$oWrS->center_horizontally() if ( $oWkS->{HCenter} );
|
||||
|
||||
# VCenter
|
||||
$oWrS->center_vertically() if ( $oWkS->{VCenter} );
|
||||
|
||||
# Header, Footer
|
||||
$oWrS->set_header( $oWkS->{Header}, $oWkS->{HeaderMargin} );
|
||||
$oWrS->set_footer( $oWkS->{Footer}, $oWkS->{FooterMargin} );
|
||||
|
||||
# Print Area
|
||||
if ( ref( $oBook->{PrintArea}[$iSheet] ) eq 'ARRAY' ) {
|
||||
my $raP;
|
||||
for $raP ( @{ $oBook->{PrintArea}[$iSheet] } ) {
|
||||
$oWrS->print_area(@$raP);
|
||||
}
|
||||
}
|
||||
|
||||
# Print Title
|
||||
my $raW;
|
||||
foreach $raW ( @{ $oBook->{PrintTitle}[$iSheet]->{Row} } ) {
|
||||
$oWrS->repeat_rows(@$raW);
|
||||
}
|
||||
foreach $raW ( @{ $oBook->{PrintTitle}[$iSheet]->{Column} } ) {
|
||||
$oWrS->repeat_columns(@$raW);
|
||||
}
|
||||
|
||||
# Print Gridlines
|
||||
if ( $oWkS->{PrintGrid} == 1 ) {
|
||||
$oWrS->hide_gridlines(0);
|
||||
}
|
||||
else {
|
||||
$oWrS->hide_gridlines(1);
|
||||
}
|
||||
|
||||
# Print Headings
|
||||
if ( $oWkS->{PrintHeaders} ) {
|
||||
$oWrS->print_row_col_headers();
|
||||
}
|
||||
|
||||
# Horizontal Page Breaks
|
||||
$oWrS->set_h_pagebreaks( @{ $oWkS->{HPageBreak} } );
|
||||
|
||||
# Veritical Page Breaks
|
||||
$oWrS->set_v_pagebreaks( @{ $oWkS->{VPageBreak} } );
|
||||
|
||||
|
||||
|
||||
# PageStart => $oWkS->{PageStart}, # Page number for start
|
||||
# UsePage => $oWkS->{UsePage}, # Use own start page number
|
||||
# NoColor => $oWkS->{NoColor}, # Print in black-white
|
||||
# Draft => $oWkS->{Draft}, # Print in draft mode
|
||||
# Notes => $oWkS->{Notes}, # Print notes
|
||||
# LeftToRight => $oWkS->{LeftToRight}, # Left to Right
|
||||
|
||||
|
||||
for (
|
||||
my $iC = $oWkS->{MinCol} ;
|
||||
defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
|
||||
$iC++
|
||||
)
|
||||
{
|
||||
if ( defined $oWkS->{ColWidth}[$iC] ) {
|
||||
if ( $oWkS->{ColWidth}[$iC] > 0 ) {
|
||||
$oWrS->set_column( $iC, $iC, $oWkS->{ColWidth}[$iC] )
|
||||
; #, undef, 1) ;
|
||||
}
|
||||
else {
|
||||
$oWrS->set_column( $iC, $iC, 0, undef, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $merged_areas = $oWkS->get_merged_areas();
|
||||
my $merged_areas_h = {};
|
||||
if ($merged_areas) {
|
||||
foreach my $range (@$merged_areas) {
|
||||
$merged_areas_h->{$range->[0]}{$range->[1]} = $range;
|
||||
}
|
||||
}
|
||||
|
||||
for (
|
||||
my $iR = $oWkS->{MinRow} ;
|
||||
defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
|
||||
$iR++
|
||||
)
|
||||
{
|
||||
$oWrS->set_row( $iR, $oWkS->{RowHeight}[$iR] );
|
||||
for (
|
||||
my $iC = $oWkS->{MinCol} ;
|
||||
defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
|
||||
$iC++
|
||||
)
|
||||
{
|
||||
|
||||
my $oWkC = $oWkS->{Cells}[$iR][$iC];
|
||||
if ($oWkC) {
|
||||
if ( $oWkC->{Merged} and exists $merged_areas_h->{$iR}{$iC} ) {
|
||||
my $oFmtN = $oWrEx->addformat();
|
||||
$oFmtN->copy( $hFmt{ $oWkC->{FormatNo} } );
|
||||
$oWrS->merge_range (
|
||||
@{$merged_areas_h->{$iR}{$iC}},
|
||||
$oBook->{FmtClass}
|
||||
->TextFmt( $oWkC->{Val}, $oWkC->{Code} ),
|
||||
$oFmtN
|
||||
);
|
||||
}
|
||||
else {
|
||||
$oWrS->write(
|
||||
$iR,
|
||||
$iC,
|
||||
$oBook->{FmtClass}
|
||||
->TextFmt( $oWkC->{Val}, $oWkC->{Code} ),
|
||||
$hFmt{ $oWkC->{FormatNo} }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $oWrEx;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# AddWorksheet (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub AddWorksheet {
|
||||
my ( $oBook, $sName, %hAttr ) = @_;
|
||||
$oBook->AddFormat if ( $#{ $oBook->{Format} } < 0 );
|
||||
$hAttr{Name} ||= $sName;
|
||||
$hAttr{LeftMargin} ||= 0;
|
||||
$hAttr{RightMargin} ||= 0;
|
||||
$hAttr{TopMargin} ||= 0;
|
||||
$hAttr{BottomMargin} ||= 0;
|
||||
$hAttr{HeaderMargin} ||= 0;
|
||||
$hAttr{FooterMargin} ||= 0;
|
||||
$hAttr{FitWidth} ||= 0;
|
||||
$hAttr{FitHeight} ||= 0;
|
||||
$hAttr{PrintGrid} ||= 0;
|
||||
my $oWkS = Spreadsheet::ParseExcel::SaveParser::Worksheet->new(%hAttr);
|
||||
$oWkS->{_Book} = $oBook;
|
||||
$oWkS->{_SheetNo} = $oBook->{SheetCount};
|
||||
$oBook->{Worksheet}[ $oBook->{SheetCount} ] = $oWkS;
|
||||
$oBook->{SheetCount}++;
|
||||
return $oWkS; #$oBook->{SheetCount} - 1;
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# AddFont (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub AddFont {
|
||||
my ( $oBook, %hAttr ) = @_;
|
||||
$hAttr{Name} ||= 'Arial';
|
||||
$hAttr{Height} ||= 10;
|
||||
$hAttr{Bold} ||= 0;
|
||||
$hAttr{Italic} ||= 0;
|
||||
$hAttr{Underline} ||= 0;
|
||||
$hAttr{Strikeout} ||= 0;
|
||||
$hAttr{Super} ||= 0;
|
||||
push @{ $oBook->{Font} }, Spreadsheet::ParseExcel::Font->new(%hAttr);
|
||||
return $#{ $oBook->{Font} };
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# AddFormat (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub AddFormat {
|
||||
my ( $oBook, %hAttr ) = @_;
|
||||
$hAttr{Fill} ||= [ 0, 0, 0 ];
|
||||
$hAttr{BdrStyle} ||= [ 0, 0, 0, 0 ];
|
||||
$hAttr{BdrColor} ||= [ 0, 0, 0, 0 ];
|
||||
$hAttr{AlignH} ||= 0;
|
||||
$hAttr{AlignV} ||= 0;
|
||||
$hAttr{Rotate} ||= 0;
|
||||
$hAttr{Landscape} ||= 0;
|
||||
$hAttr{FmtIdx} ||= 0;
|
||||
|
||||
if ( !defined( $hAttr{Font} ) ) {
|
||||
my $oFont;
|
||||
if ( defined $hAttr{FontNo} ) {
|
||||
$oFont = $oBook->{Font}[ $hAttr{FontNo} ];
|
||||
}
|
||||
elsif ( !defined $oFont ) {
|
||||
if ( $#{ $oBook->{Font} } >= 0 ) {
|
||||
$oFont = $oBook->{Font}[0];
|
||||
}
|
||||
else {
|
||||
my $iNo = $oBook->AddFont;
|
||||
$oFont = $oBook->{Font}[$iNo];
|
||||
}
|
||||
}
|
||||
$hAttr{Font} = $oFont;
|
||||
}
|
||||
push @{ $oBook->{Format} }, Spreadsheet::ParseExcel::Format->new(%hAttr);
|
||||
return $#{ $oBook->{Format} };
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# AddCell (for Spreadsheet::ParseExcel::SaveParser::Workbook)
|
||||
#------------------------------------------------------------------------------
|
||||
sub AddCell {
|
||||
my ( $oBook, $iSheet, $iR, $iC, $sVal, $oCell, $sCode ) = @_;
|
||||
my %rhKey;
|
||||
$oCell ||= $oBook->{Worksheet}[$iSheet]
|
||||
->{Cells}[$iR][$iC]->{FormatNo} || 0;
|
||||
my $iFmt =
|
||||
( UNIVERSAL::isa( $oCell, 'Spreadsheet::ParseExcel::Cell' ) )
|
||||
? $oCell->{FormatNo}
|
||||
: ( ref($oCell) ) ? 0
|
||||
: $oCell + 0;
|
||||
$rhKey{FormatNo} = $iFmt;
|
||||
$rhKey{Format} = $oBook->{Format}[$iFmt];
|
||||
$rhKey{Val} = $sVal;
|
||||
$rhKey{Code} = $sCode || '_native_';
|
||||
$oBook->{_CurSheet} = $iSheet;
|
||||
|
||||
my $merged_areas = $oBook->{Worksheet}[$iSheet]->get_merged_areas();
|
||||
my $merged_areas_h = {};
|
||||
if ($merged_areas) {
|
||||
foreach my $range (@$merged_areas) {
|
||||
$merged_areas_h->{$range->[0]}{$range->[1]} = $range;
|
||||
}
|
||||
}
|
||||
|
||||
my $oNewCell =
|
||||
Spreadsheet::ParseExcel::_NewCell( $oBook, $iR, $iC, %rhKey );
|
||||
Spreadsheet::ParseExcel::_SetDimension( $oBook, $iR, $iC, $iC );
|
||||
|
||||
$oNewCell->{Merged} = 1
|
||||
if exists $merged_areas_h->{$iR}{$iC};
|
||||
|
||||
return $oNewCell;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::SaveParser::Workbook - A class for SaveParser Workbooks.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
97
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser/Worksheet.pm
vendored
Normal file
97
database/perl/vendor/lib/Spreadsheet/ParseExcel/SaveParser/Worksheet.pm
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package Spreadsheet::ParseExcel::SaveParser::Worksheet;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::SaveParser::Worksheet - A class for SaveParser Worksheets.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
#==============================================================================
|
||||
# Spreadsheet::ParseExcel::SaveParser::Worksheet
|
||||
#==============================================================================
|
||||
|
||||
use base 'Spreadsheet::ParseExcel::Worksheet';
|
||||
our $VERSION = '0.65';
|
||||
|
||||
sub new {
|
||||
my ( $sClass, %rhIni ) = @_;
|
||||
$sClass->SUPER::new(%rhIni); # returns object
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# AddCell (for Spreadsheet::ParseExcel::SaveParser::Worksheet)
|
||||
#------------------------------------------------------------------------------
|
||||
sub AddCell {
|
||||
my ( $oSelf, $iR, $iC, $sVal, $oCell, $sCode ) = @_;
|
||||
|
||||
$oSelf->{_Book}
|
||||
->AddCell( $oSelf->{_SheetNo}, $iR, $iC, $sVal, $oCell, $sCode );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Protect (for Spreadsheet::ParseExcel::SaveParser::Worksheet)
|
||||
# - Password = undef -> No protect
|
||||
# - Password = '' -> Protected. No password
|
||||
# - Password = $pwd -> Protected. Password = $pwd
|
||||
#------------------------------------------------------------------------------
|
||||
sub Protect {
|
||||
my ( $oSelf, $sPassword ) = @_;
|
||||
$oSelf->{Protect} = $sPassword;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::SaveParser::Worksheet - A class for SaveParser Worksheets.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
1635
database/perl/vendor/lib/Spreadsheet/ParseExcel/Utility.pm
vendored
Normal file
1635
database/perl/vendor/lib/Spreadsheet/ParseExcel/Utility.pm
vendored
Normal file
File diff suppressed because it is too large
Load Diff
323
database/perl/vendor/lib/Spreadsheet/ParseExcel/Workbook.pm
vendored
Normal file
323
database/perl/vendor/lib/Spreadsheet/ParseExcel/Workbook.pm
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
package Spreadsheet::ParseExcel::Workbook;
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Spreadsheet::ParseExcel::Workbook - A class for Workbooks.
|
||||
#
|
||||
# Used in conjunction with Spreadsheet::ParseExcel.
|
||||
#
|
||||
# Copyright (c) 2014 Douglas Wilson
|
||||
# Copyright (c) 2009-2013 John McNamara
|
||||
# Copyright (c) 2006-2008 Gabor Szabo
|
||||
# Copyright (c) 2000-2006 Kawai Takanori
|
||||
#
|
||||
# perltidy with standard settings.
|
||||
#
|
||||
# Documentation after __END__
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.65';
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# new()
|
||||
#
|
||||
# Constructor.
|
||||
#
|
||||
sub new {
|
||||
my ($class) = @_;
|
||||
my $self = {};
|
||||
bless $self, $class;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
sub color_idx_to_rgb {
|
||||
my( $workbook, $iidx ) = @_;
|
||||
|
||||
my $palette = $workbook->{aColor};
|
||||
return ( ( defined $palette->[$iidx] ) ? $palette->[$iidx] : $palette->[0] );
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# worksheet()
|
||||
#
|
||||
# This method returns a single Worksheet object using either its name or index.
|
||||
#
|
||||
sub worksheet {
|
||||
my ( $oBook, $sName ) = @_;
|
||||
my $oWkS;
|
||||
foreach $oWkS ( @{ $oBook->{Worksheet} } ) {
|
||||
return $oWkS if ( $oWkS->{Name} eq $sName );
|
||||
}
|
||||
if ( $sName =~ /^\d+$/ ) {
|
||||
return $oBook->{Worksheet}->[$sName];
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# worksheets()
|
||||
#
|
||||
# Returns an array of Worksheet objects.
|
||||
#
|
||||
sub worksheets {
|
||||
my $self = shift;
|
||||
|
||||
return @{ $self->{Worksheet} };
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# worksheet_count()
|
||||
#
|
||||
# Returns the number Woksheet objects in the Workbook.
|
||||
#
|
||||
sub worksheet_count {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{SheetCount};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_filename()
|
||||
#
|
||||
# Returns the name of the Excel file of C<undef> if the data was read from a filehandle rather than a file.
|
||||
#
|
||||
sub get_filename {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{File};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_print_areas()
|
||||
#
|
||||
# Returns an array ref of print areas.
|
||||
#
|
||||
# TODO. This should really be a Worksheet method.
|
||||
#
|
||||
sub get_print_areas {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{PrintArea};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# get_print_titles()
|
||||
#
|
||||
# Returns an array ref of print title hash refs.
|
||||
#
|
||||
# TODO. This should really be a Worksheet method.
|
||||
#
|
||||
sub get_print_titles {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{PrintTitle};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# using_1904_date()
|
||||
#
|
||||
# Returns true if the Excel file is using the 1904 date epoch.
|
||||
#
|
||||
sub using_1904_date {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
return $self->{Flg1904};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# ParseAbort()
|
||||
#
|
||||
# Todo
|
||||
#
|
||||
sub ParseAbort {
|
||||
my ( $self, $val ) = @_;
|
||||
$self->{_ParseAbort} = $val;
|
||||
}
|
||||
|
||||
=head2 get_active_sheet()
|
||||
|
||||
Return the number of the active (open) worksheet (at the time the workbook
|
||||
was saved. May return undef.
|
||||
|
||||
=cut
|
||||
|
||||
sub get_active_sheet {
|
||||
my $workbook = shift;
|
||||
|
||||
return $workbook->{ActiveSheet};
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Parse(). Deprecated.
|
||||
#
|
||||
# Syntactic wrapper around Spreadsheet::ParseExcel::Parse().
|
||||
# This method is *deprecated* since it doesn't conform to the current
|
||||
# error handling in the S::PE Parse() method.
|
||||
#
|
||||
sub Parse {
|
||||
|
||||
my ( $class, $source, $formatter ) = @_;
|
||||
my $excel = Spreadsheet::ParseExcel->new();
|
||||
my $workbook = $excel->Parse( $source, $formatter );
|
||||
$workbook->{_Excel} = $excel;
|
||||
return $workbook;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Mapping between legacy method names and new names.
|
||||
#
|
||||
{
|
||||
no warnings; # Ignore warnings about variables used only once.
|
||||
*Worksheet = *worksheet;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Spreadsheet::ParseExcel::Workbook - A class for Workbooks.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See the documentation for Spreadsheet::ParseExcel.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for L<Spreadsheet::ParseExcel>.
|
||||
|
||||
|
||||
=head1 Methods
|
||||
|
||||
The following Workbook methods are available:
|
||||
|
||||
$workbook->worksheets()
|
||||
$workbook->worksheet()
|
||||
$workbook->worksheet_count()
|
||||
$workbook->get_filename()
|
||||
$workbook->get_print_areas()
|
||||
$workbook->get_print_titles()
|
||||
$workbook->using_1904_date()
|
||||
|
||||
|
||||
=head2 worksheets()
|
||||
|
||||
The C<worksheets()> method returns an array of Worksheet objects. This was most commonly used to iterate over the worksheets in a workbook:
|
||||
|
||||
for my $worksheet ( $workbook->worksheets() ) {
|
||||
...
|
||||
}
|
||||
|
||||
|
||||
=head2 worksheet()
|
||||
|
||||
The C<worksheet()> method returns a single C<Worksheet> object using either its name or index:
|
||||
|
||||
$worksheet = $workbook->worksheet('Sheet1');
|
||||
$worksheet = $workbook->worksheet(0);
|
||||
|
||||
Returns C<undef> if the sheet name or index doesn't exist.
|
||||
|
||||
|
||||
=head2 worksheet_count()
|
||||
|
||||
The C<worksheet_count()> method returns the number of Woksheet objects in the Workbook.
|
||||
|
||||
my $worksheet_count = $workbook->worksheet_count();
|
||||
|
||||
|
||||
=head2 get_filename()
|
||||
|
||||
The C<get_filename()> method returns the name of the Excel file of C<undef> if the data was read from a filehandle rather than a file.
|
||||
|
||||
my $filename = $workbook->get_filename();
|
||||
|
||||
|
||||
=head2 get_print_areas()
|
||||
|
||||
The C<get_print_areas()> method returns an array ref of print areas.
|
||||
|
||||
my $print_areas = $workbook->get_print_areas();
|
||||
|
||||
Each print area is as follows:
|
||||
|
||||
[ $start_row, $start_col, $end_row, $end_col ]
|
||||
|
||||
Returns undef if there are no print areas.
|
||||
|
||||
|
||||
=head2 get_print_titles()
|
||||
|
||||
The C<get_print_titles()> method returns an array ref of print title hash refs.
|
||||
|
||||
my $print_titles = $workbook->get_print_titles();
|
||||
|
||||
Each print title array ref is as follows:
|
||||
|
||||
{
|
||||
Row => [ $start_row, $end_row ],
|
||||
Column => [ $start_col, $end_col ],
|
||||
}
|
||||
|
||||
|
||||
Returns undef if there are no print titles.
|
||||
|
||||
|
||||
=head2 using_1904_date()
|
||||
|
||||
The C<using_1904_date()> method returns true if the Excel file is using the 1904 date epoch instead of the 1900 epoch.
|
||||
|
||||
my $using_1904_date = $workbook->using_1904_date();
|
||||
|
||||
The Windows version of Excel generally uses the 1900 epoch while the Mac version of Excel generally uses the 1904 epoch.
|
||||
|
||||
Returns 0 if the 1900 epoch is in use.
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Current maintainer 0.60+: Douglas Wilson dougw@cpan.org
|
||||
|
||||
Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org
|
||||
|
||||
Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org
|
||||
|
||||
Original author: Kawai Takanori kwitknr@cpan.org
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2014 Douglas Wilson
|
||||
|
||||
Copyright (c) 2009-2013 John McNamara
|
||||
|
||||
Copyright (c) 2006-2008 Gabor Szabo
|
||||
|
||||
Copyright (c) 2000-2006 Kawai Takanori
|
||||
|
||||
All rights reserved.
|
||||
|
||||
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
|
||||
|
||||
=cut
|
||||
1038
database/perl/vendor/lib/Spreadsheet/ParseExcel/Worksheet.pm
vendored
Normal file
1038
database/perl/vendor/lib/Spreadsheet/ParseExcel/Worksheet.pm
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user