打印多个文件 [英] Print multiple files
本文介绍了打印多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我生成的文本文件如report-1,report-2等。
现在打印时如何通过一个命令打印它们。
表示某个时候可能有2个报告文件或者可能是4.
所以如何编写循环来获取所有文件并一个接一个地打印延迟。
Hi all
I am generating text file like report-1, report-2 etc.
Now while printing how to print them at a single command.
means sometime there may be 2 report files or may be 4.
so how to write the loop to take all the files and print them one by one with a delay.
int lines = File.ReadAllLines(@"C:\ReportPrint.txt").Count();
if (printerType == "2 Inch Printer" && lines > 50)
{
splitfiles();
string s = "CMD /c COPY " + Program.DeptFilePath + "ReportPrint-1.txt" + " " + billingBHWS.TokenPrinter;
Interaction.Shell(s, AppWinStyle.Hide, false, 1000);
string s11 = "CMD /c COPY " + Program.DeptFilePath + "ReportPrint-2.txt" + " " + billingBHWS.TokenPrinter;
Interaction.Shell(s11, AppWinStyle.Hide, false, 1000);
string s22 = "CMD /c COPY " + Program.DeptFilePath + "ReportPrint-3.txt" + " " + billingBHWS.TokenPrinter;
Interaction.Shell(s22, AppWinStyle.Hide, false, 1000);
break;
这是我正在使用的代码现在用于打印。我的报告文件是修复的(即3)所以我这样写了。
我想用单行编写。
请告诉我怎么做..
This is the code i am using now for printing.here my report file is fix (i.e. 3)so i wrote like this.
This i want to make in single line.
Please tell me how to do this..
推荐答案
你只需要放一个外循环并循环遍历目录中的所有文件,或者你的任何文件业务逻辑是。
有关示例,请参阅 http://stackoverflow.com/questions/4254339/how-to-loop-through-all-the-files-in-a-directory- in-c-net [ ^ ]
You just need to put an outer loop and loop through all the files in the directory, or whatever your business logic is.
For an example see http://stackoverflow.com/questions/4254339/how-to-loop-through-all-the-files-in-a-directory-in-c-net[^]
这篇关于打印多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文