使用Delphi调用条形码控件BarTender打印标签
procedure TForm1.btn1Click(Sender: TObject);
begin
with btApp1.Formats.Open('c:/test.btw', True, '') do //打开标签文件
begin
SetNamedSubStringValue('BarCode1', '1234567890'); //设置值
SetNamedSubStringValue('Text1', 'Hello BarTender!');
PrintOut(False, False); //打印
Close(btDoNotSaveChanges); //关闭不保存
end;
btApp1.Quit(btDoNotSaveChanges); //退出
end;
|
- 顶
- 0
- 踩
- ------
The Formats.Open method has three arguments. The first argument is required and is a string containing the path of the label format file to open. The second argument is a Boolean: if it is true, the method will close the default blank format called "Format1" that BarTender automatically opens when it starts. It cannot close formats that have any other name. The third argument specifies a printer to use.
If you have multiple formats opened in BarTender, you can use the Formats collection object to return a reference to any opened format. A format can be identified by specifying either the format name or index identifier. You can also bring focus to an opened label format using the Format.Activate method. The following example assigns the specified label format (Format1.btw) to be the active label format in BarTender.