当前位置:首页经验技巧Office经验office基础

小票如何打印word,小票,打印

2026-01-06 12:59:38

1.能用word打印小票吗?

可以~安装1600K的专用控件。

装上第三方控件后你可以自行修改也可以用~

如下:

附例:Delphi

//生成打印数据文件 dirname+`prn.txt`

procedure TForm1.SaveTxt;

var F :Textfile;

begin

AssignFile(F,dirname+`prn.txt`);

try

ReWrite(F);

Writeln(F,`要打印的第一行`);

Writeln(F,`要打印的第二行`);

Writeln(F,`要打印的第三行`);

Writeln(F,`要打印的第四行`);

Writeln(F,`要打印的第五行`);

//。。

finally

Closefile(F);

end;

end;

/////////

---------------------------------------

//调用打印接口程序的方法

procedure TForm1.Printme;

var

sCommandLine: string;

bCreateProcess: boolean;

lpStartupInfo: TStartupInfo;

lpProcessInformation: TProcessInformation;

begin //命令行参数

sCommandLine :=dirname+`Printer.EXE `+dirname+`prn.txt *****`;

// 填入 StartupInfo 信息

FillChar(lpStartupInfo,Sizeof(TStartupInfo),#0);

lpStartupInfo.cb := Sizeof(TStartupInfo);

lpStartupInfo.dwFlags := STARTF_USESHOWWINDOW;

lpStartupInfo.wShowWindow := SW_NORMAL;

//启动进程(调用打印接口程序)

bCreateProcess := CreateProcess(nil,PChar(sCommandLine),nil,nil,True,

CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,lpStartupInfo,lpProcessInformation);

end;

-----------------------------------------

//!!!!!!!!!当然,还有一个更简单的方法可以生成txt文件,如下:

1.用一个ListBox1控件,其Visible属性设为False

ListBox1.Items.Clear;

ListBox1.Items.Add(`要打印的第一行`);

ListBox1.Items.Add(`要打印的第二行`);

//。.等等

ListBox1.Items.SaveToFile(dirname+`prn.txt`);

Printme;//调用套件,开始执行打印。。OK!!!!!!!!简单吧!!!!!!!!!


免责声明:本站信息来自网络收集及网友投稿,仅供参考,如果有错误请反馈给我们更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任,谢谢您的合作。
版权所有:五学知识网 Copyright © 2015-2026 www.z8000w.com. All Rights Reserved .