first commit

This commit is contained in:
2026-01-09 19:14:41 +08:00
commit 9f3c96ce73
67 changed files with 9636 additions and 0 deletions

27
backend/read_spec.py Normal file
View File

@@ -0,0 +1,27 @@
import docx
import sys
def read_docx(file_path):
doc = docx.Document(file_path)
content = []
# Iterate through all elements in the document in order
for element in doc.element.body:
if element.tag.endswith('p'): # Paragraph
para = docx.text.paragraph.Paragraph(element, doc)
if para.text.strip():
content.append(para.text)
elif element.tag.endswith('tbl'): # Table
table = docx.table.Table(element, doc)
for row in table.rows:
row_text = [cell.text.strip() for cell in row.cells]
content.append(" | ".join(row_text))
return '\n'.join(content)
if __name__ == "__main__":
path = r"c:\Users\USER\Desktop\SampleOrderAssistant\data\業務資料比對與轉換率分析系統 - 邏輯規格書 (v1.0).docx"
content = read_docx(path)
with open("spec_content.txt", "w", encoding="utf-8") as f:
f.write(content)
print("Content written to spec_content.txt")