Check Digits

Hi all,

I'm using FR 4.2 Delphi Xe2 update 2. I've been using EAN13 barcodes in a report with a check digits ('Calc Checksum') and it all works fine. I've even checked that the checkdigit is calculated correctly which it is.

If I switch the barcode to EAN8, I don't seem to get a check digit, just my barcode value. The barcode text also seems to be all left aligned rather than right aligned as with EAN13. The 'Calc Checksum' is ticked for the barcode object.

Any ideas ?

Thanks
Bill.

Comments

  • edited 2:44AM
    I think I have found the culprit

    frxBarCode.pas
    function TfrxBarcode.Code_EAN8:AnsiString;

    Its not setting FText correctly to include the check digit in the text.

    Does anyone agree with this ? If so, will we see it fixed in a future build ?

    Thanks
    Bill.
  • edited 2:44AM
    I know its a long time but FastReport send me a fix for this problem (frxBarcod.pas):
    procedure TfrxBarcode.DrawBarcode(Canvas: TCanvas; ARect: TRect; ShowText: Boolean); 
    ... 
    procedure OutText; 
    var 
    TxtWidth: Integer; 
    FontHandle, OldFontHandle: HFont; 
    begin 
    with EMFCanvas do 
    begin 
    {Font.Name := 'Arial'; 
    Font.Size := 9; } 
    Font.Assign(FFont); 
    FontHandle := CreateRotatedFont(Font, Round(FAngle)); 
    OldFontHandle := SelectObject(Handle, FontHandle); 
    Brush.Color := Color; 
    SetBkMode(Handle, Transparent); 
    
    case FTyp of 
    bcCodeEAN8: // 8 digits, 4+4 
    begin 
    //fix begin 
    if FCheckSum then 
    begin 
    TextOutR(3, 3, 30, Copy(DoCheckSumming(copy(FText,length(FText)-6,7)), 1, 4)); 
    TextOutR(35, 35, BarWidth - 4, Copy(DoCheckSumming(copy(FText,length(FText)-6,7)), 5, 4)); 
    end 
    else 
    begin 
    TextOutR(3, 3, 30, Copy(FText, 1, 4)); 
    TextOutR(35, 35, BarWidth - 4, Copy(FText, 5, 4)); 
    end 
    ///fix end
    
    It works, i also requested to include this fix to the next FastReport Version, because its apparently a bug.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.