Conditional Formatting
I am trying to change a text field font selection "White on Black" based on a value in
in my case_description datebase field. It supplies 2 values. "NS" and "Standard".
If the value is "Standard" I want no selection. If it is "NS" I want "White on Black" selected.
Is this possible with Vbscript. Any help would be appreciated.
-
The quick answer is yes. See the following white paper: http://www.seagullscientific.com/label-software/whitepapers/dynamically-changing-objects-at-print-time-using-vb-script.pdf
Object properties to adjust would be:
Object.TextBackgroundColor = Color
Object.TextColor = Color
See the BarTender help system for a full reference of all properties available.
0 -
I tried this as a test but can't get it to work.
Set Notice = Objects("Text_16")
If (Field("case_description") = "NS") then
Notice.TextColor = btColor.RedColor.
Else Notice.TextColor.Green
end if
0 -
I read the documentation. It doesn't work. Not a big surprise.
0 -
What's with the tone...? I got this to work in like 2 minutes just now, so...
- Make the database connection
- Create a dummy BarTender text object to hold the database value
- Assign a name to the data source of that object/substring
- Go to File > BarTender Document Options > VB Scripting
- Check "Use VB Scripting", add something like the below code to the "OnNewRecord" event
If Format.NamedSubStrings("bg_val").Value = "NS" Then Format.Objects("test").TextBackgroundColor = Black Format.Objects("test").TextColor = Red Else Format.Objects("test").TextBackgroundColor = Green Format.Objects("test").TextColor = Black End If..whereas "bg_val" is the name of the data source that holds the database value and "test" is the name of the (BarTender) object you want to manipulate.
0 -
Shotaro Ito
★ BarTender Hero ★
When you use Seagull driver, make sure print box as [Raster Graphics],
From Print dialog > Object Print Method > Box.
Also do not use device font (Printer font), use Truetype / Opentype font.
0 -
I finally got it to work. I was overlooking the named data source. Thanks for the info.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
6 Kommentare