1. 程式人生 > >不使用fastreport自帶的條碼組件打印快遞單(一款很不錯的條碼組件下載)

不使用fastreport自帶的條碼組件打印快遞單(一款很不錯的條碼組件下載)

安裝 tof dial 沒有 .cn als cep win rep

由於沒有正確安裝fastreport組件,導致沒法使用fastreport中的條碼組件,如何解決:

思路:

1、雖然條碼組件不能使用,但有fastreport中picture組件可用。

2、查找可以生成一維碼圖片的組件。通過尋找找到了Barcode(下載)

3、利用picture的filelink屬性,在報表中加載第二步產生的條碼bmp圖片。

步驟如下:

一、設計報表

1、在fastreport設計器中加入picture組件

2、設置picture的FileLink屬性:c:\barcode.bmp;

二、編寫代碼,利用Barcode組件,產生一維碼:

var
Barcode1: TAsBarcode;
begin
Barcode1 := TAsBarcode.Create(self);
Barcode1.Top := 0;
Barcode1.Left := 0;
Barcode1.Modul := 1;
Barcode1.Ratio := 2.0;
Barcode1.Height := 75;
Barcode1.Text := ‘012345678’;
Barcode1.ShowText := bcoCode;
Barcode1.Typ := TBarcodeType(5);
Barcode1.ShowTextPosition := TShowTextPosition(5);
Barcode1.Modul := 3;
try
Barcode1.Angle := 90;
except
Barcode1.Angle := 0.0;
end;
Image1.Picture := nil;
Barcode1.DrawBarcode(Image1.Canvas);
Image1.Picture.BITMAP.SaveToFile(‘c:\barcode.bmp‘);//(同FileLink屬性一致)
frxReport1.LoadFromFile(‘xxx.fr3‘);
frxReport1.PrepareReport;

frxReport1.PrintOptions.ShowDialog := False;
frxReport1.Print;

不使用fastreport自帶的條碼組件打印快遞單(一款很不錯的條碼組件下載)