How to Change the Color of a Cell in DIAdem Table with Scripting

Updated Oct 27, 2020



  • DIAdem

I am trying to change the text color of a cell of a 2D table in a report. In older version of DIAdem, I was able to use the D2TabNumColor variable, however, this command is now obsolete. How can I achieve this functionality with a newer version of DIAdem?

To obtain this type of functionality the object-oriented interface in DIAdem REPORT must be used. You can use the event OnDrawingCell for 2DTable Colums Settings.

The first example script in this help page is the script that you will run. It will create a table in a report and then call the user command script (the second example script) on the referenced column of the table. The user command script will then access each cell of the table individually and make the changes. You can modify this user command script as below to just change the color of a cell:

Sub MyOnDrawingCell(Context, Cell)
  If (Context.Table.Name = "My2DTable") Then
    If (Cell.Value > 0.06) Then
    End If
  End If
End Sub