use Win32::OLE;
my $wd = Win32::OLE->new('WPS.Application')
|| die "CreateObject: " . Win32::OLE->LastError;
$wd->{Visible} = 1;
my $document = $wd->Documents->Add();
$wd->Selection->Font->{Name} = "宋体";
$wd->Selection->Font->{Size} = 12;
$wd->Selection->Font->{Animation} = 3;
$wd->Selection->TypeText("This is a demo");
$document->SaveAs('ole.doc',undef,undef,"111");
从复旦周晓方的课程中的例子简单修改了一下,主要是使用OLE技术。不过真要是使用,多看office的相关程序更有用。
阅读(2036) | 评论(0) | 转发(0) |