添加过滤

main
还不如一只猪威武 1 week ago
parent fb4514e91d
commit df9f122399

3
.gitignore vendored

@ -2,3 +2,6 @@
/dist/
.idea
*.spec
.venv
*.docx
!template.docx

@ -26,12 +26,12 @@
},
{
"key": "{Test1}",
"value": "2025年11月26日",
"value": "2TEst1打赏",
"type": "text"
},
{
"key": "{Test2}",
"value": "2025年11月26日",
"value": "20TEst2打赏萨格",
"type": "text"
},
{

Binary file not shown.

@ -119,10 +119,11 @@ def replace(template_path, filename_path, data_json):
repeat = True
else:
for paragraph in cell.paragraphs:
paragraph.text = paragraph.text.replace(" ", "")
for run in paragraph.runs:
find = False
for datum in data_json:
if datum["key"] in cell.text:
if datum["key"] in run.text:
find = True
if "text" == datum["type"]:
run.text = run.text.replace(datum["key"], datum["value"])

Binary file not shown.
Loading…
Cancel
Save