I know, but this set the alignment for the table itself. I need to align the text inside the cells.

I think I solved the problem using:

Qt Code:
  1. cell_cursor = table.cellAt(i, j).firstCursorPosition()
  2. cell_cursor.setBlockFormat(centerFormat)
To copy to clipboard, switch view to plain text mode 

Where:
Qt Code:
  1. centerFormat = QTextBlockFormat()
  2. centerFormat.setAlignment(Qt.AlignCenter)
To copy to clipboard, switch view to plain text mode 

I'm using PyQt.