DIAdem Help

Object: 2DTableDrawingCell

  • Updated2024-09-12
  • 2 minute(s) read

Object: 2DTableDrawingCell

The 2DTableDrawingCell object provides information about the cell DIAdem is plotting in a 2D table in DIAdem REPORT.

Note  To test the example script, you must first save the second script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example generates a table with two columns and assigns the MyOnDrawingCell user command to the cells in the first column:

Dim oMy2DTable, oMyPosition, oMyColumn1, oMyColumn2
Call Report.NewLayout()
Set oMy2DTable = Report.ActiveSheet.Objects.Add(eReportObject2DTable,"My2DTable")
Set oMyPosition = oMy2DTable.Position.ByBorder
oMyPosition.Top = 30
oMyPosition.Bottom = 20
oMyPosition.Left = 20
oMyPosition.Right = 30
Set oMyColumn1 = oMy2DTable.Columns.Add(e2DTableColumnChannel)
oMyColumn1.Channel.Reference = "[1]/[1]"
Set oMyColumn2 = oMy2DTable.Columns.Add(e2DTableColumnChannel)
oMyColumn2.Channel.Reference = "[1]/[2]"
oMy2DTable.Settings.IndexSettings.IndexMode = e2DTableIndexModeAutomaticallyIncreasing
oMyColumn1.Settings.OnDrawingCell = "MyOnDrawingCell"

The user command changes the display and the contents of the cells being plotted. The user command receives two parameters. The first parameter corresponds to a 2DTableDrawingCellContext object and provides information about the table, the column, the cell, and the worksheet in which DIAdem is plotting the cell. The second parameter corresponds to a 2DTableDrawingCell object and provides information about the cell DIAdem is plotting:

Sub MyOnDrawingCell(Context, Cell)
  If (Context.Table.Name = "My2DTable")  Then
    Cell.Font.Color.SetRGBColor(RGB(255, 128, 128))
    If Context.Row = 1 Then
      Cell.Value = Cell.Value & " Sheet: " & Context.Sheet.Name
    Else
      Cell.Value = Cell.Value & " Col: " & Context.Col & "; Row: " & Context.Row  & "; Rel. row: " & Context.RelativeRow 
    End If
  End If
End Sub

Properties

Angle | BackgroundColor | Font | Value