Leser: 1
![]() |
|< 1 2 >| | ![]() |
11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
use lib $FindBin::RealBin . "/modules";
use Spreadsheet::SimpleExcel;
binmode(\*STDOUT);
# data for spreadsheet
my @header = qw(Header1 Header2);
my @data = (['Row1Col1', 'Row1Col2'],
['Row2Col1', 'Row2Col2']);
# create a new instance
my $excel = Spreadsheet::SimpleExcel->new();
# add worksheets
$excel->add_worksheet('Name of Worksheet',{-headers => \@header, -data => \@data});
$excel->add_worksheet('Second Worksheet',{-data => \@data});
$excel->add_worksheet('Test');
# add a row into the middle
$excel->add_row_at('Name of Worksheet',1,[qw/new row/]);
# sort data of worksheet - ASC or DESC
$excel->sort_data('Name of Worksheet',0,'DESC');
# remove a worksheet
$excel->del_worksheet('Test');
# sort worksheets
$excel->sort_worksheets('DESC');
# create the spreadsheet
$excel->output();
# print sheet-names
print join(", ",$excel->sheets()),"\n";
# get the result as a string
my $spreadsheet = $excel->output_as_string();
# print result into a file and handle error
$excel->output_to_file("my_excel.xls") or die $excel->errstr();
$excel->output_to_file("my_excel2.xls",45000) or die $excel->errstr();
QuoteCan't use string ("Name of Worksheet") as an ARRAY ref while "strict refs" in use at .../modules/Spreadsheet/SimpleExcel.pm line 343.
$excel->add_row_at('Name of Worksheet',1,[qw/new row/]);
1
2
3
4
5
6
7
sub _is_numeric{
my ($arref,$index) = @_;
foreach(@$arref){
return 0 if($_->[$index] =~ /[^\d\.]/); # Zeile 343
}
return 1;
}# end _is_numeric
1
2
3
4
5
6
7
8
9
sub _is_numeric{
my ($arref,$index) = @_;
foreach(@$arref){
no strict 'refs';
return 0 if($_->[$index] =~ /[^\d\.]/);
use strict 'refs';
}
return 1;
}# end _is_numeric
1
2
3
4
5
6
7
8
9
10
Use of uninitialized value in array element at .../prg/modules/Spreadsheet/SimpleExcel.pm line 351.
Use of uninitialized value in pattern match (m//) at .../prg/modules/Spreadsheet/SimpleExcel.pm line 351.
Use of uninitialized value in array element at .../prg/modules/Spreadsheet/SimpleExcel.pm line 351.
Use of uninitialized value in pattern match (m//) at .../prg/modules/Spreadsheet/SimpleExcel.pm line 351.
Argument "Second Worksheet" isn't numeric in numeric comparison (<=>) at .../prg/modules/Spreadsheet/Simp
leExcel.pm line 331.
Argument "Name of Worksheet" isn't numeric in numeric comparison (<=>) at .../prg/modules/Spreadsheet/Sim
pleExcel.pm line 331.
![]() |
|< 1 2 >| | ![]() |
11 Einträge, 2 Seiten |