ODT template into resources
This commit was merged in pull request #11.
This commit is contained in:
@@ -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"
|
||||
|
||||
# Заголовок
|
||||
|
||||
BIN
redmine_reporter/templates/template.odt
Normal file
BIN
redmine_reporter/templates/template.odt
Normal file
Binary file not shown.
Reference in New Issue
Block a user