python 报告生成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/110760/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 19:30:48  来源:igfitidea点击:

Report generation

pythonreport

提问by Hannes Ovrén

I am writing a web app using TurboGears, and in that app the users must be able to generate different reports. The data the reports need is stored in a database (MySQL). The reports must be returned either as a easily printable html document, or a pdf file.

我正在使用 TurboGears 编写一个网络应用程序,在该应用程序中,用户必须能够生成不同的报告。报告所需的数据存储在数据库 (MySQL) 中。报告必须作为易于打印的 html 文档或 pdf 文件返回。

I have previously used jasper and iReport for creating the documents, but if I can avoid having to fire up Java to create the report I would be happy.

我以前使用 jasper 和 iReport 来创建文档,但是如果我可以避免必须启动 Java 来创建报告,我会很高兴。

Ideally I would like to specify reports in a easily readable markup language and then just feed the template data with some kind of library that produces the report.

理想情况下,我想以易于阅读的标记语言指定报告,然后只使用某种生成报告的库来提供模板数据。

I gladly accept any kind of hints on how I should go about generating these reports!

我很乐意接受有关如何生成这些报告的任何提示!

采纳答案by tsg

You can build some fancy PDFs from Python with the ReportLabtoolkit.

您可以使用ReportLab工具包从 Python 构建一些精美的 PDF 。

回答by Toni Ru?a

Podis my favorite solution to your problem.

Pod是我最喜欢的解决您问题的方法。

回答by Sklivvz

A partial answer: the easily readable format you are looking for might be DocBook. From there it is very easy to go to PDF, html, RTF, etc. etc.

部分答案:您正在寻找的易于阅读的格式可能是DocBook。从那里可以很容易地转到 PDF、html、RTF 等。