我有一些代码可以使用pyrtf创建表。并且由于此模块没有文档..我无法设置某些属性,例如文本背景色,表边框和列对齐方式,因此如何设置这些属性。
from PyRTF import *
def make_table( ) :
doc = Document()
section = Section()
doc.Sections.append( section )
col1 = 1000
col2 = 1000
section.append( 'Table one', border =?? )
table = Table( col1, col2)
table.AddRow( Cell( 'column1'),FONTsize=?? ,backgroundCOLOR=??,align =?? ), Cell('column2') )
section.append( table )
return doc
if __name__ == '__main__' :
renderer = Renderer()
renderer.Write( make_table(), file( 'table.rtf', 'w' ) )
print "created"
http://www.web2py.com/examples/static/sphinx/gluon/gluon.contrib.pyrtf.html