python
pip install relatorio
python
from relatorio.templates.opendocument import Template
import matplotlib.pyplot as plt
labels = ['A', 'B', 'C', 'D']
values = [10, 15, 7, 12]
plt.bar(labels, values)
chart_path = 'chart.png'
plt.savefig(chart_path)
template = Template(path='report_template.odt', static_path='.')
context = {
'chart': chart_path,
}
report_path = 'report.odt'
template.generate(context).render().save(report_path)
print(f'Report saved to: {report_path}')