Change table's text color based on it's value Seguir

Jamie Wojcik

I have a table built to mimic an Excel file when it prints.  It has a basic header line and then the dynamic data line below it.  I have the database connection setup to use an Excel file.  On one of the columns, I want the text to print red when it's a negative number.  I have the data source set to the correct column.  In the Excel file, it's a float or decimal number, but the column is set to be defined as US currency.  In BarTender, I have the Data Type set to Currency also.  It prints the information correctly.  However, I don't see an option to change the text color to red if it's a negative number.

I've tried the following code in Document Options / OnNewRecord.

If (Format.Objects("Text 32").Value < 0) Then

    Format.Objects("Text 32").TextColor = BtColor.Red

End If

I've even tried something more complicated like:

If (InStr(CStr(Format.Objects("Text 32").Value), "-") <> 0) Then

    Format.Objects("Text 32").TextColor = BtColor.Red

End If

But, the whole column of data is Red, whether the number is negative or positive.  Is there a better solution to this?

Thank you, thank you!!

Iniciar sesión para dejar un comentario.