修改答辩题目页面大小

This commit is contained in:
2025-06-06 12:07:55 +08:00
parent 2a7873549d
commit dedfc9a959
3 changed files with 7 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ import pathlib
from copy import deepcopy
from docx import Document
from docx.shared import Cm
from docx.shared import Cm, Mm
from module.schema import Course, Student
@@ -14,6 +14,8 @@ class DocPaper:
self._filename = filename
section = self._doc.sections[0]
section.page_width = Mm(210)
section.page_height = Mm(297)
section.top_margin = Cm(2)
section.bottom_margin = Cm(2)
section.left_margin = Cm(2)

View File

@@ -62,12 +62,14 @@ class DTGWorker(QObject):
doc = word.Documents.Open(word_file)
try:
doc.SaveAs(pdf_file, 17)
doc.Close()
os.remove(word_file)
os.startfile(pdf_file)
except Exception as e:
raise Exception("PDF转换失败但Word文档已生成") from e
finally:
doc.Close()
os.startfile(word_file)
raise Exception("PDF转换失败但Word文档已生成已打开Word文档") from e
finally:
word.Quit()
elif self.output_type == 'word':
os.startfile(word_file)

Binary file not shown.