Thread Problem mit Spreadsheet::SimpleExcel (10 answers)
Opened by Crian at 2007-07-12 15:07

Crian
 2007-07-12 15:07
#78404 #78404
User since
2003-08-04
5873 Artikel
ModeratorIn
[Homepage]
user image
Ich hab folgendes Testprogramm (aus der Synopsis):

Code: (dl )
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();


und ich bekomme die Fehlermeldung

Quote
Can't use string ("Name of Worksheet") as an ARRAY ref while "strict refs" in use at .../modules/Spreadsheet/SimpleExcel.pm line 343.


Mmmh? Name of Worksheet taucht einmal bei $excel->add_worksheet und einmal bei $excel->add_row_at auf. Mmmh.

Renee, liest du zufällig gerade hier?
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite

View full thread Problem mit Spreadsheet::SimpleExcel