Individual Table Cell Format

How can I change the format of the text for an individual cell in a table? The value that I want to highlight will always be in the same position.

With Power Table, using configureCell extension function.

I’m using the regular Table, not the Power Table. Is it impossible with the regular Table component?

Yes, but it becomes in too much effort for something that is already supported with the power table.
You will need to feel comfortable with JTable class and viewports and related stuff.

Ok, I’ll give the power table a shot.

Thanks

Where can I find the syntax for changing the attributes of the cells? (font, for example)

I tried the same format as the font string, but that did not seem to work.

if rowView == 0 & colView == 0:
		return {"Lucida Console, Bold, 18" : self.font}

Close. I believe it’s:

if rowView == 0 & colView == 0:
		return {'font': "Lucida Console, Bold, 18"}

Thank you

As an side note, you may want to consider setting up a ‘default format’. Then, you can just change the property you need for each scenario.

# Define default cell properties
config = {
          'foreground': 'black',
		  'background': 'white',
		  'font' : 'Dialog, Plain, 12'
		 }

if selected:
	config['background'] = self.selectionBackground
	config['foreground'] = self.selectionForeground
	
if rowView == 0 & colView == 0:
	config['font'] = "Lucida Console, Bold, 18"

return config
1 Like