PERL操作程序六十(從WEB啟動(dòng)Excel的讀寫(xiě))
返回
Apache perl Win32::OLE Excelファイルを操作, XP=>Windows7/Windwos8変更時(shí),エラーが発生!
*** OLE exception from "Microsoft Excel": ファイル
'D:\wwwexcel\samples\sample_ENQ.xls' にアクセスできません。次のいずれかの理由が考えられます。
? ファイル名またはパスが存在しません。
? ファイルが他のプログラムによって使用されています。
? 保存しようとしているブックと同じ名前のブックが現(xiàn)在開(kāi)かれています。
Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Open" at ./pro/mscwrite_excel.pl line 114.
114: $book = $t{ex}->Workbooks->Open("D:\\wwwexcel\\samples\\sample_ENQ.xls");
==>次のようにフォルダを追加しました。問(wèn)題解決!
C:\Windows\SysWOW64\config\systemprofile\Desktop
Please make this folder.
C:\Windows\System32\config\systemprofile\Desktop
http://xxx.xxx.xx.xxx/cgi-bin/Scripts/excel01.pl
#!C:/perl/bin/perl
# excel01.pl
use strict;
use DBI;
use CGI qw/:standard/;
use HTML::Template;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use File::Copy;
$Win32::OLE::Warn = 3; # die on errors..
my (%t,$Excel,$Book,$Sheet);
print "Content-type: text/html; charset=UTF-8\n\n";
print "This page is for writing data to excel file!\n";
$Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application','Quit');
$Excel->{DisplayAlerts} = 'False';
$Book = $Excel->Workbooks->Open("D:\\wwwexcel\\samples\\sample_ENQ.xls");
$t{excel} = 'sekidatabase1.xls';
$Book->SaveAs("D:\\wwwexcel\\output\\$t{excel}");
#$Book->Close;
# close
undef $Book;
undef $Excel;
1;
返回
五台县|
呈贡县|
潢川县|
绵阳市|
仁寿县|
保亭|
荃湾区|
衡阳市|
博爱县|
海兴县|
雷波县|
邹平县|
石景山区|
淳化县|
清流县|
林西县|
普格县|
吉木萨尔县|
连州市|
平顺县|
南乐县|
金堂县|
莎车县|
长乐市|
大竹县|
中西区|
阳城县|
偏关县|
襄汾县|
宁国市|
中牟县|
阳西县|
元阳县|
玛多县|
定襄县|
新河县|
库伦旗|
无极县|
云林县|
吉木萨尔县|
林甸县|