Voici un petit moment que je cherche et je préfère demander de l'aide car je ne trouve pas ?
ma question est : comment faire pour imprimer 2 tableaux le premier avec une bordure comme dans un tableur, le second sans bordure !!!
voici un petit bout de code si vous pouvez m'aider.
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#premier tableau avec bordure
orderTableFormat = QtGui.QTextTableFormat()
orderTableFormat.setAlignment(QtCore.Qt.AlignCenter)
orderTable = cursor.insertTable(1,1, orderTableFormat)
orderFrameFormat = cursor.currentFrame().frameFormat()
orderFrameFormat.setBorder(1)
cursor.currentFrame().setFrameFormat(orderFrameFormat)
cursor = orderTable.cellAt(0, 0).firstCursorPosition().setBlockFormat(alignCentrer)
cursor = orderTable.cellAt(0, 0).lastCursorPosition()
cursor.insertText('essai',titreFormat)
 
#second tableau sans bordure
orderTableFormat2 = QtGui.QTextTableFormat()
orderTableFormat2.setAlignment(QtCore.Qt.AlignCenter)
orderTable2 = cursor.insertTable(1,1, orderTableFormat2)
orderFrameFormat2 = cursor.currentFrame().frameFormat()
orderFrameFormat2.setBorder(0)
cursor.currentFrame().setFrameFormat(orderFrameFormat2)
cursor = orderTable2.cellAt(0, 0).firstCursorPosition().setBlockFormat(alignCentrer)
cursor = orderTable2.cellAt(0, 0).lastCursorPosition()
cursor.insertText('essai',titreFormat)