python from relatorio.templates.opendocument import Template tpl = Template('template.odt', static_folder='.') styles = { 'header': {'color': 'red', 'font-weight': 'bold'}, 'table': {'border-color': 'gray', 'border-width': '1px'}, 'cell': {'padding': '5px'}, } tpl.styles['$header'] = styles['header'] tpl.styles['$table'] = styles['table'] tpl.styles['$cell'] = styles['cell'] data = {'title': 'Sample Report', 'data': [['A', 'B'], [1, 2], [3, 4]]} output = tpl.generate(data=data) output.write(open('report.odt', 'wb'))


上一篇:
下一篇:
切换中文