word-document-processor은(는) 무엇을 하나요?
포괄적인 워드 문서 처리 기능을 제공합니다. 문서 생성, 편집, 서식 유지, 변경 내용 추적, 메타데이터 관리를 지원합니다.
기능
- 문서 생성: 새 Word 문서(.docx)를 생성합니다.
- 문서 편집: 기존 문서의 내용을 수정합니다.
- 서식 유지: 글꼴, 색상, 정렬, 표, 이미지 등의 서식을 유지합니다.
- 변경 내용 추적: 문서 변경 사항을 추적하고 검토합니다.
- 메타데이터 관리: 문서 속성(작성자, 제목, 설명 등)을 관리합니다.
지원 플랫폼
- Claude Code
- Cursor
- Codex
- 기타 AI 코딩 에이전트
사용 방법
문서 생성
from docx import Document
document = Document()
document.add_heading('문서 제목', level=1)
document.add_paragraph('이것은 단락입니다.')
document.save('새_문서.docx')
기존 문서 편집
from docx import Document
document = Document('기존_문서.docx')
for paragraph in document.paragraphs:
if '특정 텍스트' in paragraph.text:
paragraph.text = '수정된 텍스트'
document.save('수정된_문서.docx')
변경 내용 추적
변경 내용 추적은 문서에 대한 변경 사항을 기록하고 검토할 수 있는 기능입니다. python-docx 라이브러리를 사용하여 변경 내용을 추적할 수 있습니다.
from docx import Document
from docx.oxml.ns import qn
document = Document()
# 변경 내용 추적 활성화
body = document.element.body
body.set(qn('w:revisionView'), '1')
document.save('변경_추적_문서.docx')
메타데이터 관리
from docx import Document
document = Document()
core_properties = document.core_properties
core_properties.author = '작성자 이름'
core_properties.title = '문서 제목'
core_properties.subject = '문서 주제'
core_properties.description = '문서 설명'
document.save('메타데이터_문서.docx')
주의 사항
- 모든 Word 기능이 완벽하게 지원되는 것은 아닙니다.
- 일부 복잡한 서식은 손실될 수 있습니다.
- 변경 내용 추적은 python-docx의 제한된 지원을 받습니다.