Thread Win32::OLE & Excel->Write Problem (5 answers)
Opened by NixIsFix at 2009-04-28 12:04

Gast wer
 2009-04-28 12:47
#120975 #120975
Ohne mich mit Win32::OLE aus zu kennen
ein paar Tips:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
my $pfad="Pfad\\";
foreach my $Tmp ( sort keys %Files ) {
       my $tmpfile="${pfad}tmp-File.xls";
       my $outputfile="${pfad}${Tmp}-File.xls";

       my $workbook1 = Spreadsheet::WriteExcel->new( $tmpfile ) || die "Error opening ";
       print STDERR "-Generate $outputfile File...\n";
       $workbook1->close();
       unlink( $outputfile ) if ( -e $outputfile );

       my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new( 'Excel.Application', 'Quit' );
       my $workbook2 = $Excel->Workbooks->Open( $tmpfile );
       $workbook2->SaveAs($outputfile ,xlExcel9795);
       #                                   ^ist das so richtig?
       $workbook2->Close;

       unlink( $tmpfile ) or print STRDERR "error unlink $tmpfile\n";
       print STDERR ".... finished\n";
}


Übrigens deine Beispielausgebe korresponiert nicht mit dem Code.

View full thread Win32::OLE & Excel->Write Problem