Add frontend/backend analysis report and DOCX export

This commit is contained in:
aitest
2026-03-05 12:25:29 +09:00
commit 9be2d2daba
3 changed files with 192 additions and 0 deletions

30
generate_analysis_docx.py Normal file
View File

@@ -0,0 +1,30 @@
from docx import Document
from docx.shared import Pt
from pathlib import Path
md_path = Path(r"C:\Users\ALC\.openclaw\workspace\analysis_report_content.md")
out_path = Path(r"C:\Users\ALC\.openclaw\workspace\前后端功能与开源可修改性分析报告.docx")
text = md_path.read_text(encoding='utf-8')
doc = Document()
style = doc.styles['Normal']
style.font.name = 'Microsoft YaHei'
style.font.size = Pt(10.5)
for line in text.splitlines():
if line.startswith('# '):
doc.add_heading(line[2:].strip(), level=1)
elif line.startswith('## '):
doc.add_heading(line[3:].strip(), level=2)
elif line.startswith('### '):
doc.add_heading(line[4:].strip(), level=3)
elif line.startswith('- '):
doc.add_paragraph(line[2:].strip(), style='List Bullet')
elif line.strip() == '---':
doc.add_paragraph('')
else:
doc.add_paragraph(line)
doc.save(out_path)
print(str(out_path))