1

我无法使用 perl(草莓)和 win32::ole 使用 powerpoint(来自 office2010)将 ppt(x) 转换为 pdf。

我可以使用 Export 函数很好地导出为 jpg,但ExportAsFixedFormat函数的语法非常晦涩,而且总是给我 Win32::OLE(0.1709) error 0x80020011: "Does not support a collection"

这是我正在尝试的示例

    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

任何人都可以提出一个可行的例子吗?

4

2 回答 2

1

只是为了完成 golemwashere 的答案:

use Win32::OLE::Const 'Microsoft PowerPoint';
...
$Presentation->SaveAs("$outfile",ppSaveAsPDF, 1);

这在 Windows 7 上使用 powerpoint 2007 有效,但必须忽略返回值。

于 2012-01-23T18:07:11.447 回答
-1

我解决了使用

$Presentation->SaveAs("$outfile", 32);

很难发现 32 = pdf 格式和 $outfile 需要正斜杠:/ 在路径中(使用 \ 我得到了令人困惑的错误)。

于 2011-09-30T12:28:51.910 回答