ODT template into resources

This commit was merged in pull request #11.
This commit is contained in:
Артём Кокос
2026-01-25 12:24:32 +07:00
parent 1f77088c21
commit ea90fe79d0
3 changed files with 9 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
import os
from importlib import resources
from typing import List
from odf.opendocument import load
from odf.text import P
@@ -24,11 +25,10 @@ class ODTFormatter(Formatter):
"""
Форматирует данные в объект OpenDocument.
"""
template_path = "template.odt"
if not os.path.exists(template_path):
raise FileNotFoundError("Шаблон template.odt не найден...")
doc = load(template_path)
with resources.files("redmine_reporter").joinpath("templates", "template.odt").open("rb") as f:
doc = load(f)
para_style_name = "Standard"
# Заголовок

Binary file not shown.