简体   繁体   English

使用delphi xe3在MS Word的纸张两面打印文档

[英]Print a document in MS Word on both sides of paper using delphi xe3

How can i print a Word document on both sides using code in Delphi xe 3? 如何使用Delphi XE 3中的代码在双面打印Word文档?

Below is how the word document is created: 以下是单词文档的创建方式:

  try
  { Open the document}
   WrdApp := CreateOLEObject('Word.Application');
   wrdDoc := WrdApp.Documents.Open(document);
  // Wrddoc.SaveAs(SaveToFile);
  except
   on E: Exception do
    begin
     E.Message := 'Could Not Execute MS WORD!';
     raise;
    end;
  end;

Any help would be greatly appreciated thank you 任何帮助将不胜感激谢谢

KB 194306 demonstrates printing duplex using Word automation. KB 194306演示了使用Word自动化进行打印双面打印。 The key is to insert a field , and then enter the printer-specific escape code to tell the printer to print in duplex mode. 关键是插入一个字段 ,然后输入打印机专用的转义码,以告知打印机以双面打印方式进行打印。 In Delphi, it might go something like this: 在Delphi中,可能会发生以下情况:

wrddoc.Selection.Fields.Add(wrddoc.Selection.Range, -1, 'PRINT 27 &l1S');

Then you can call Printout as normal to have Word print the document. 然后,您可以像往常一样调用Printout来让Word打印文档。

The article mentions that the escape code shown here is for HP printer drivers. 本文提到,此处显示的转义码适用于HP打印机驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM