powerpoint 的 perl Win32::OLE ExportAsFixedFormat 语法
我在使用 perl (草莓) 和 win32::ole 使用 powerpoint (来自 office2010) 时遇到问题 将 ppt(x) 转换为 pdf。
我可以使用导出功能导出为 jpg,但功能 ExportAsFixedFormat 有一个相当晦涩的语法,总是给我 Win32::OLE(0.1709) 错误 0x80020011:“不支持集合”
。
这是我正在尝试的示例
my $ppoint = Win32::OLE->new('PowerPoint.Application', 'Quit');
my $Presentation = $ppoint->Presentations->Open("$infile") || die("Una +ble to open document ", Win32::OLE->LastError()) ;
$Presentation->ExportAsFixedFormat("$outfile", 2, 2, "msoCTrue", "ppPrintHandoutHorizontalFir +st", "ppPrintOutputFourSlideHandouts", "msoFalse", "", "" , "", "Fals +e", "False", "False", "False", "False");
第二个参数 ppFixedFormatTypePDF 应该是 2
第三个参数“ppFixedFormatIntentPrint”应该是 2
有人可以建议一个工作示例吗?
I have trouble using perl (strawberry) and win32::ole using powerpoint (from office2010)
to convert ppt(x) to pdf.
I can export to jpgs fine with Export function but the function ExportAsFixedFormat has a quite obscure syntax and alwawys gives meWin32::OLE(0.1709) error 0x80020011: "Does not support a collection"
.
this is a sample of what I am trying
my $ppoint = Win32::OLE->new('PowerPoint.Application', 'Quit');
my $Presentation = $ppoint->Presentations->Open("$infile") || die("Una +ble to open document ", Win32::OLE->LastError()) ;
$Presentation->ExportAsFixedFormat("$outfile", 2, 2, "msoCTrue", "ppPrintHandoutHorizontalFir +st", "ppPrintOutputFourSlideHandouts", "msoFalse", "", "" , "", "Fals +e", "False", "False", "False", "False");
second parameter ppFixedFormatTypePDF should be 2
third param 'ppFixedFormatIntentPrint' should be 2
Can anyone suggest a working example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是为了完成 golemwashere 的答案:
这可以在 Windows 7 上使用 powerpoint 2007,但必须忽略返回值。
Just to complete the answer from golemwashere:
This works using powerpoint 2007 on windows 7, but the return value has to be ignored.
我使用
$Presentation->SaveAs("$outfile", 32);
解决了
发现 32 = pdf 格式很棘手
并且 $outfile 需要正斜杠:/
在路径中(使用 \ 我得到了令人困惑的错误)。
I solved using
$Presentation->SaveAs("$outfile", 32);
it was tricky finding that 32 = pdf format
and also $outfile needed foward slashes : /
in path (with \ I got confusing errors).