如何让打印机打印报告

时间:2017-04-19 04:53:31

标签: printing visual-foxpro foxpro

如果在报告中使用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()。这需要从REPORT中删除PROMPT子句

如何使用PROMPT子句获取打印报告的打印机: 报告表xxx打印提示

如果这可能,可能有一些sys()函数或其他一些或者是否可以在报表打印期间获取打印机名称?

或者该命令应该重新考虑不使用PROMPT子句,如:

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

1 个答案:

答案 0 :(得分:0)

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

这是一个有用的示例包装函数。我通常会打电话给#34; 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
相关问题