2017-04-19 56 views
1

如果prompt calsue在报告中使用如何获得地方报道印

REPORT FORM xxx to PRINT PROMPT 

用户可以选择其中打印报告打印机的打印机。 如何获取此打印机名称进行日志记录?

https://support.microsoft.com/en-us/help/162798/how-to-use-the-set-printer-to-name-command-to-print-to-a-specified-printer-in-visual-foxpro

展会热点使用GETPRINTER()这一点。这需要从报告中除去PROMPT子句

如何获得打印机,其中报告使用PROMPT子句印刷: REPORT FORM XXX TO PRINT PROMPT

如果possbible,也许thereis一些SYS()函数或somethis其他或报告打印过程中是否可以获取打印机名称?

还是应该该命令重新分解不要使用PROMPT子句,如:

cPrinter = getprinter() 
set printer to name (cPrinter) 
REPORT FORM xxx TO PRINT 
insert into logfile (PrinterUsedForPrinting) values (cPrinter) 

回答

0

我会使用电话GETPRINTER之前运行报告(无PROMPT子句)的解决方案建议。在我长期使用FoxPro/VFP的经验中,我认为我没有遇到过通过REPORT FORM ... PROMPT来确定打印机的方法。

下面是一个示例包装函数,您可能会觉得有用。在运行报告之前,我通常会调用“PickPrinter”。如果PickPrinter返回一个空字符串,我放弃报告运行。

FUNCTION PickPrinter 
    IF APRINTERS(a_printers) < 1 
     MESSAGEBOX("No printers defined.") 
     RETURN "" 
    ELSE 
     lcPrnChoice = "" 
     lcPrnChoice = GETPRINTER() 
     IF EMPTY(lcPrnChoice) 
      RETURN "" 
     ELSE 
      *** Include quotes around the printer name 
      *** in case there are spaces in the name 
      lcPrnChoice = "NAME [" + lcPrnChoice + "]" 
      SET PRINTER TO &lcPrnChoice 

      RETURN lcPrnChoice 
     ENDIF 
    ENDIF 
ENDFUNC