delphi 如何将WORD转换为PDF

[复制链接]
查看11 | 回复3 | 2015-11-5 19:54:22 | 显示全部楼层 |阅读模式
使用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;
回复

使用道具 举报

千问 | 2015-11-5 19:54:22 | 显示全部楼层
编程?用Delphi?五体投地!
回复

使用道具 举报

千问 | 2015-11-5 19:54:22 | 显示全部楼层
var
wdo,wdoc,wdocs : OleVariant;
begin
wdo := CreateOleObject('Word.Application');
wdocs := wdo.Documents;
wdo.ActivePrinter := 'Acrobat PDFWriter';
wdoc := wdocs.Open('c:\test.doc');
wdoc.PrintOut(0, 0, 0,'c:\test.pdf');
end;参考资料:http://support.adobe.com/devsup/devsup.nsf/docs/50876.htm本回答被网友采纳
回复

使用道具 举报

千问 | 2015-11-5 19:54:22 | 显示全部楼层
你打算怎么转换呢?貌似很难。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行