Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Barcode width at runtime

edited September 2005 in General
Greetings!

I need to print a footer like this:

and the barcode area needs to be as far to the right as possible to leave
the most room possible for signatures.

The problem is that depending on the encoded characters, the barcode can
change its width and run off the side of the page. Is there a way to
determine the exact width of a barcode at runtime? Then I will have to find
a way to shift the barcode to the left enough to print the whole thing, and
shrink the signature area to accomodate the new barcode size. Horizontal
shifting components would be very helpful here!

Thanks for any ideas you may have.

Gary

Comments

  • edited September 2005
    Hi Gary,

    You may be able to use the OnDrawCommandCreate event to determine the
    calculated width of the barcode component on your report. Then you will
    need to be sure the barcode is drawn before any other report components.

    ReportBuilder 9.0x now includes an Anchors feature for every report
    component. This allows you to anchor a component to any two adjascent sides
    of the report so if the page or the component changes, it will shift
    accordingly automatically. For instance setting the right anchor of your
    barcode object will keep it the original defined distance from the right
    side of the report no matter how big the barcode becomes.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Hi Nico,

    Thanks for the response!

    I upgraded to v9.02 and set the anchors for the barcode to top/right and it
    didn't make any difference! The barcode still grew to the right - off the
    side of the page. What could be going on here?

    Thanks for your help,
    Gary

  • edited September 2005
    Hi Gary,

    Which barcode format are you using? Is the barcode lined up as far to the
    right as possible in your design window? How far off the page does the
    barcode extend? I will try to recreate this behavior on my machine and see
    if I can find a solution for you. (Which may include improving the way
    anchors handle dynamic objects).

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Hi Nico,

    I am using a TppDBBarCode with a type of Code128. The barcode is set against
    the right margin with the Alignment property set to taRightJustify (which
    doesn't set the barcode to right align in the space provided- it seems like
    it should, just the text aligns with the right edge of the barcode), Anchors
    to [atTop, atRight], and PrintHumanReadable set to True. Depending on the
    encoding string (characters produce a wider barcode then numbers) it will be
    over 1/4" to 5/8" off the right side of the page.

    I did a quick test with a label set against the right margin. The Anchors
    were set to [atTop, atRight], the TextAlignment property set to
    taRightJustified and it worked perfectly. When I passed a longer string to
    it, it correctly grew to the left.

    Thanks very much for your help. I appreciate it.

    Gary


  • edited September 2005
    Hi Gary,

    Take a look at the following example. It shows how to use the
    OnDrawCommandCreate event to right align the actual bar code rendering.
    Hope this helps.

    http://www.digital-metaphors.com/tips/DBBarCodeRightAlign.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Hi Nico,

    Thanks for the example! Very cool - it works great and will help alot.

    I appreciate your help!
    Gary

This discussion has been closed.