使用vba来指定保存的文件格式为pdf,当然前提必须已安装MS Office的PDF输出插件(默认应该有)procedure TForm1.btn1Click(Sender: TObject);varwdo,wdoc,wdocs : OleVariant;begin
wdo := CreateOleObject('Word.Application');
wdocs := wdo.Documents;
wdoc := wdocs.Open('d:\test.docx');
wdoc.ExportAsFixedFormat(OutputFileName:=
'd:\test.pdf', ExportFormat:=17);
//查word的宏帮助 {
OpenAfterExport:='True', OptimizeFor:='wdExportOptimizeForPrint', Range:=
'wdExportAllDocument', From:=1, To:=1, Item:='wdExportDocumentContent',
IncludeDocProps:='True', KeepIRM:='True', CreateBookmarks:=
'wdExportCreateNoBookmarks', DocStructureTags:='True', BitmapMissingFonts:=
'True', UseISO19005_1:='False');
}end;
|