zoukankan      html  css  js  c++  java
  • delphi word转pdf两种方法。

     1 uses ComObj;
     2 procedure TForm1.Button1Click(Sender: TObject);
     3 var
     4    wdo,wdoc,wdocs : OleVariant;
     5 begin
     6   wdo := CreateOleObject('Word.Application');
     7   wdocs := wdo.Documents;
     8   wdo.ActivePrinter := 'Acrobat PDFWriter';
     9   wdoc := wdocs.Open('C:docfile.docx');
    10   //另存为的方法可以用saveas
    11   wdoc.ExportAsFixedFormat('C:pdffile.pdf',
    12                         17, false,
    13                         EmptyParam,
    14                         EmptyParam,
    15                          EmptyParam,
    16                         EmptyParam, EmptyParam,
    17                          true,
    18                         true, true, true,
    19                         true, false,
    20                         EmptyParam);
    21 
    22  //虚拟打印机的方法
    23  wdoc.PrintOut(0, 0, 0,'C:pdffile.pdf');
    24 
    25 end;
     1 uses ComObj;
     2 procedure TForm1.Button1Click(Sender: TObject);
     3 var
     4    wdo,wdoc,wdocs : OleVariant;
     5 begin
     6   wdo := CreateOleObject('Word.Application');
     7   wdocs := wdo.Documents;
     8   wdo.ActivePrinter := 'Acrobat PDFWriter';
     9   wdoc := wdocs.Open('C:docfile.docx');
    10   //另存为的方法可以用saveas
    11   wdoc.ExportAsFixedFormat('C:pdffile.pdf',
    12                         17, false,
    13                         EmptyParam,
    14                         EmptyParam,
    15                          EmptyParam,
    16                         EmptyParam, EmptyParam,
    17                          true,
    18                         true, true, true,
    19                         true, false,
    20                         EmptyParam);
    21 
    22  //虚拟打印机的方法
    23  wdoc.PrintOut(0, 0, 0,'C:pdffile.pdf');
    24 
    25 end;
  • 相关阅读:
    [转]为Ubuntu Server安装gnome图形桌面环境
    [转]ubuntu 安装五笔输入法
    [转]更改文件所有者
    QT 透明设置
    ubuntu 交叉编译arm linux 内核
    Opencv vs 2005编译
    [转]在skyeye中运行uboot
    object的引用 与 foreach的使用
    音频和视频
    HTML5 Canvas API
  • 原文地址:https://www.cnblogs.com/prtmon/p/5530127.html
Copyright © 2011-2022 走看看