Can't Set Fontsize In Vb-Script. Bug?
My Problem with FontSize:
''' Current FontSize in two Labels is 12Pt and 10 Pt (GUI). If price to long: Format.Objects("price_before_dec_point").FontSize = 7 ' Label for 1...7 character Format.Objects("price_after_dec_point").FontSize = 5 ' Label for exact 2 digits
On printing anf after print is FotSize always 1 (one), why? Is it a Bug?
VB Script is started as Document-Script in OnNewRecord-Part.
My Version: Enterprise Automation 10.1 SR2 Build 2945 (Windows 7 x86 SP1)
Thanks
-
Any reason why you don't use the auto size option in the text object properties of your label design?
Can you attach an example document that demonstrates the issue to examine, or failing that the full script.
0 -
Legacy Poster
★ BarTender Hero ★
OK, see Attachment. For test please copy files to C:\BtTest.
Both Object/Controls have a synchron Zoom for FontSize in VB-Script.
I can use HTML Ort XAML, but not Text Object for change FontSize.
My Question is: is it a bug?
Thanks.
0 -
Legacy Poster
★ BarTender Hero ★
' Solution for HTML-Label with VB-Script:
''''' In Function and Sub '''''
Function HtmlVorPrice(Price)
Dim s, length, digits_before_point, digits_after_point, size
s = Price & ""
length = Len(s)
' min 4 chararcter, by < "0,00" no output
If length < 4 Then
HtmlVorPrice ="<html><body></body></html>"
Exit Function
End If
digits_before_point = Left(s, length - 3 )
digits_after_point = Right(s, 2)
Select Case Len(s)
Case 4: size = 13
Case 5: size = 12
Case 6: size = 12
Case 7: size = 10
Case 8: size = 10
Case 9: size = 9
Case 10: size = 8
Case Else: size = 7
End Select
s = "<html>" & vbCrLf & _
"<head>" & vbCrLf & _
" <style type='text/css'>" & vbCrLf & _
" body {font-family: 'Arial Narrow'; font-size: '" & size & "pt'; font-weight: bold;}" & vbCrLf & _
" </style>" & vbCrLf & _
"</head>" & vbCrLf & _
"<body>" & vbCrLf & _
" <center>" & vbCrLf & _
digits_before_point & "<sup style='font-size:70%'> <u>" & digits_after_point & "</u></sup>" & vbCrLf & _
" </center>" & vbCrLf & _
"</body>" & vbCrLf & _
"</html>"
HtmlVorPrice = s
End Function
''''' In OnNewRecord '''''
ReferenceField "txt_price"
Value = HtmlVorPrice(Field("txt_price"))''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Output for Price = "5,00":
500
' Digits before and after decimal point zoomed synchronously, ' If Len(Price) > 4:
1000 00''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Bad output with auto size and two labels is:
100000
0 -
I'm confused now. Are you having problem using standard BarTender text, or using HTML container text?? Your posts suggest that the HTML route is your workaround, and yet you've not sent me the BarTender document (best) or VB script of the implementation which that you're having problems.
0 -
Legacy Poster
★ BarTender Hero ★
Sorry, i had a Problem with upload.
For a Price-Label i've created two BarTender-Objects (Text type) and FontSize = 12 and 10.
Example: 500
For Price with more as 3 digits have i written in VB-Script
Format.Objects("price_before_dec_point").FontSize= 7
Format.Objects("price_after_dec_point").FontSize = 5
That worked, but after start was FontSize = 1, always !
This was my first question: "Is it a Bug?"
Unfortunately, my question was not answered.
If i use the auto size function, is the Result for 5,00 and 1000,00 :
500 and 100000
Smaller is only first field (5->1000, not 00-> 00).This is not a synchron Zoom for both fields!
Correct result is 500 and 1000 00
In my previous answer is a solution for this Problem. I use VB-Script in a HTML-object.But this is a complex solution …
My question: works VB-Script FontSize with a Text-Object, or is it a bug? (always changed to 1 Point)
Sorry for my poor knowledge of english.
Thanks.
0 -
I suggest you attach your example BarTender document, so I can see what you're doing, as your explanations are not crystal clear to me. If you're connecting to a data file of some kind please attach that too. Note you might need to use a simple delimited text file for the purpose of demonstration.
I'm not aware of a bug in this area, but at the moment I'm not sure on what you're doing exactly so cannot go about trying to reproduce the error.
0 -
Legacy Poster
★ BarTender Hero ★
Demo for FontSize - Bug:
[attachment=797:FontSizeNotOK.btw]
[attachment=798:FontSizeNotOK.txt]
0 -
Your code in the document level VB script was bad, so I rewrote it for you in a nested If...Then statement. Note that you can set a second argument (for a default value) in the Field() function call in order to avoid design time errors.
ReferenceField("FontSizeNotOK.FontSize") If IsNumeric(Field("FontSizeNotOK.FontSize",12)) Then If Field("FontSizeNotOK.FontSize",101) > 100 Then Format.Objects("Text 1").FontSize = 100 Else Format.Objects("Text 1").FontSize = Field("FontSizeNotOK.FontSize",12) End If Else Format.Objects("Text 1").FontSize = 100 End If
0 -
Legacy Poster
★ BarTender Hero ★
Good, the Function Field() has a optional 2. Parameter for default Value.
But after run
Format.Objects("Text 1").FontSize = 100 or
Format.Objects("Text 1").FontSize = Field("FontSizeNotOK.FontSize",12)
is FontSize equal 1. Please send a bug report to the BarTender developer team.
Best regards and end of discussion.
0 -
I'm not sure what you're getting at there. As per the attached and the preview, all works fine for me.
*Note you'll need to adjust back the location of the data file.
0 -
Legacy Poster
★ BarTender Hero ★
Sorry, don't work ...
My Version: Enterprise Automation 10.1 SR2 Build 2945 (Windows 7 x86 SP1) Location: Germany.
After new BarTender-download and new installation the same effekt.
Please see the PNG-File.
[attachment=859:FonSizeNotOK!.PNG]
0 -
Attach the files you're working with so we can see what's wrong.
0 -
Legacy Poster
★ BarTender Hero ★
How have they recommended I have indeed used your files from 13.02.2014.
To download I used this link:
http://www.bartenderbarcodesoftware.com/ftp/BarTender/10.1/BT101_SR2_2945_Suite.exe
Thanks for your help, but this must Developer check. I'll wait for the next update.
0 -
I don't know what you're doing wrong, but it works absolutely fine on my PC. This is not a BarTender version issue.
0 -
Legacy Poster
★ BarTender Hero ★
I've got the exact same issue.
I'm using activeX to control bartender within Internet Explorer.
Everything works fine except setting FontSize. FontSize is always 1 after modifying its value.
I've tried to use another object fontsize value but it is the same.
I'm using BT 10.1 SR3
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
15 commentaires