ActiveReports 7 Now Available! (click for details)

ActiveReports for .NET Support

Started by SBCProgrammer at 03-21-2011 10:32 AM. Topic has 4 replies.

Print Search Rate
Sort Posts:    
   03-21-2011, 10:32 AM
SBCProgrammer is not online. Last active: 4/30/2011 1:37:19 AM SBCProgrammer

Not Ranked
Joined on 03-21-2011
Posts 1
Barcode sizing
I am creating a 128Auto barcode that gets the data from different part numbers in a database.

If the length of the data is different the barcode even when set to AutoSize true seems to autosize to the same width.

Is there a way to get the barcode to autosize based on the length of the data?
   Report 
   03-23-2011, 6:23 AM
SankalpS is not online. Last active: 3/22/2013 7:42:11 AM SankalpS

Top 10 Posts
Joined on 12-11-2008
Posts 3,316

DDStaff
Re: Barcode sizing
SBCProgrammer,

It is possible to set the width for the barcode on the fly; however calculating the length of the caption and then setting the barcode width is not possible. For example if the barcode's caption is "Test" and you calculate its length, it will come out to 4. However if you use the same value for the barcode width it will make it 4 inches in length. Therefore, I cannot think of any way to get the results which you are looking for.

Regards,
Sankalp

Sankalp Sen
GrapeCity- DataDynamics
   Report 
   09-06-2011, 11:00 PM
RyanJ is not online. Last active: 8/15/2011 7:04:52 PM RyanJ

Not Ranked
Joined on 08-28-2004
Posts 16
Re: Barcode sizing
I was basically going to ask the same question.

Currently what I do is handle the Detail.BeforePrint event. I test for Barcode1.Text.Length and set Barcode1.Width to different sizes depending on the length of the text value. The problem is, we are always tweaking this logic. What we need is for the barcode control to automatically draw itself to the optimal size for scanning based on the length of the barcode value.


   Report 
   09-12-2011, 10:37 PM
SankalpS is not online. Last active: 3/22/2013 7:42:11 AM SankalpS

Top 10 Posts
Joined on 12-11-2008
Posts 3,316

DDStaff
Re: Barcode sizing
SBCProgrammer and RyanJ,

I have been able to find a way to autosize the barcode based on the length of the data. You can use the following code in the Format event of the section containing the barcode:

           barcode1.Text = "this is a long text";
           Page page1 = new Page();
           page1.Font = barcode1.Font;
           page1.Units = Units.Inches;
           float t = page1.MeasureText(barcode1.Text).Width;
           barcode1.Width = t;


Let me know if this works for you.

Regards,
Sankalp

Sankalp Sen
GrapeCity- DataDynamics
   Report 
   01-09-2013, 12:30 AM
alartine is not online. Last active: 1/9/2013 2:16:09 PM alartine

Not Ranked
Joined on 01-09-2013
Posts 1
Re: Barcode sizing
It is possible to adjust the Code 128 barcode width based on the data length by using such a barcode generator tool, whose Code 128auto data mode works fine!

   Report 
GrapeCity » Product Support » ActiveReports f... » Re: Barcode sizing

Privacy Policy | Copyright © 1997-2013 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.