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;
  • 相关阅读:
    JAVA理解逻辑程序的书上全部重要的习题
    体检套餐管理系统的综合版
    一路奔跑,一路寻找
    员工考勤信息管理小程序
    枚举的独特强大之处
    C#中HashTable的用法
    项目经理评分
    若想成功,请记住!
    数组的经典例子
    S1的小成果:MyKTV系统
  • 原文地址:https://www.cnblogs.com/prtmon/p/5530127.html
Copyright © 2011-2022 走看看