使用PyRTF格式化

问题描述 投票:0回答:1

我有一些代码可以使用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"
python python-2.7 python-3.x rtf
1个回答
0
投票
我认为这将帮助您解决问题,请通过以下链接:

http://www.web2py.com/examples/static/sphinx/gluon/gluon.contrib.pyrtf.html

© www.soinside.com 2019 - 2024. All rights reserved.