| |
|

ActiveReports for .NET Support
Started by SBCProgrammer at 03-21-2011 10:32 AM. Topic has 4 replies.
 
 
 
|
|
Sort Posts:
|
|
|
|
03-21-2011, 10:32 AM
|
SBCProgrammer
Joined on 03-21-2011
Posts 1
|
|
|
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
Joined on 12-11-2008
Posts 3,316

|
|
|
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
Joined on 08-28-2004
Posts 16
|
|
|
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
Joined on 12-11-2008
Posts 3,316

|
|
|
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
Joined on 01-09-2013
Posts 1
|
|
|
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
|
|
|
|
|