Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from PyRTF import *
- def ExempleTableau():
- docu = Document()
- ss = docu.StyleSheet
- section = Section()
- docu.Sections.append(section)
- cote_fin = BorderPS( width=20, style=BorderPS.SINGLE )
- cote_epais = BorderPS( width=80, style=BorderPS.SINGLE )
- bord_fin = FramePS( cote_fin, cote_fin, cote_fin, cote_fin )
- bord_epais = FramePS( cote_epais, cote_epais, cote_epais, cote_epais )
- bord_mixte = FramePS( cote_fin, cote_epais, cote_fin, cote_epais )
- tableau = Table(TabPS.DEFAULT_WIDTH * 3, TabPS.DEFAULT_WIDTH * 3, TabPS.DEFAULT_WIDTH * 3)
- c1 = Cell( Paragraph( 'L1C1' ), bord_fin )
- c2 = Cell( Paragraph( 'L1C2' ) )
- c3 = Cell( Paragraph( 'L1C3' ), bord_epais )
- tableau.AddRow( c1, c2, c3 )
- c1 = Cell( Paragraph( 'L2C1' ) )
- c2 = Cell( Paragraph( 'L2C2' ) )
- c3 = Cell( Paragraph( 'L2C3' ) )
- tableau.AddRow( c1, c2, c3 )
- c1 = Cell( Paragraph( 'L3C1' ), bord_mixte )
- c2 = Cell( Paragraph( 'L3C2' ) )
- c3 = Cell( Paragraph( 'L3C3' ), bord_mixte )
- tableau.AddRow( c1, c2, c3 )
- section.append(tableau)
- return docu
- def OuvreFichier(nom):
- return file('%s.rtf' % nom, 'w')
- if __name__ == '__main__':
- DR = Renderer()
- docu = ExempleTableau()
- DR.Write(docu, OuvreFichier('rtftable-a'))
- print "Fini"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement