Files
AX-Copilot-Codex/dist/AxCopilot/skills/docx-creator.skill.md
lacvet a027ea4f9a
Some checks failed
Release Gate / gate (push) Has been cancelled
재구성 AX Agent 설정과 채팅 UI를 Claude형 구조로
2026-04-04 17:48:51 +09:00

3.8 KiB

name, label, description, icon, allowed-tools, tabs
name label description icon allowed-tools tabs
docx-creator Word 문서 생성 Python을 사용하여 전문적인 Word 문서(.docx)를 생성합니다. 작업 폴더의 양식 파일을 자동 활용합니다. \uE8A5
folder_map
document_read
file_read
file_write
process
document_assemble
format_convert
cowork

사용자의 요구에 맞는 전문적인 Word 문서를 Python으로 생성하세요.

실행 경로 선택 (Python 가능/불가)

  • 먼저 processpython --version을 확인하세요.
  • Python 가능: 기존 python-docx 경로를 사용하세요.
  • Python 불가: document_assemble로 문서 본문을 구성하고 format_convert로 docx 산출을 시도하세요. 실패 시 Markdown/HTML 결과와 변환 가이드를 함께 제공하세요.

사전 준비

먼저 python-docx 패키지가 설치되어 있는지 확인하고, 없으면 설치하세요:

process: pip install python-docx

양식 활용 (템플릿 모드)

작업 폴더에 양식 파일이 있으면 반드시 활용하세요:

  1. 양식 탐색: folder_map으로 작업 폴더를 스캔하여 .docx 파일 확인
  2. 양식 후보 판별:
    • 파일명에 "양식", "template", "서식", "표준", "기본" 포함
    • 또는 사용자가 명시적으로 "XX 양식으로 작성해줘" 요청
    • 또는 사용자가 특정 .docx 파일명을 언급
  3. 양식 구조 파악: document_read로 양식 파일의 구조(스타일, 헤더, 섹션)를 먼저 확인
  4. 양식 기반 생성:
    doc = Document('양식_보고서.docx')  # ← 빈 Document() 대신 양식 로드
    # 양식의 스타일, 머리글/바닥글, 로고, 페이지 설정이 자동 상속됨
    # 기존 본문 내용을 지우고 새 내용만 추가
    for paragraph in doc.paragraphs:
        paragraph.clear()  # 기존 내용 제거
    # 또는 필요에 따라 특정 섹션만 교체
    
  5. 양식이 없으면: 아래 기본 템플릿으로 새 문서 생성

작업 절차

  1. 요구사항 파악: 사용자가 원하는 문서의 종류, 구조, 내용을 확인
  2. 양식 확인: folder_map으로 작업 폴더에 양식 .docx 파일이 있는지 확인
  3. Python 스크립트 작성: file_write로 .py 파일 생성
  4. 스크립트 실행: process로 Python 스크립트 실행
  5. 결과 확인: 생성된 .docx 파일 경로를 사용자에게 안내

Python 스크립트 템플릿

from docx import Document
from docx.shared import Inches, Pt, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.style import WD_STYLE_TYPE
import os

# 양식 파일 자동 감지
template_keywords = ['양식', 'template', '서식', '표준', '기본']
template_file = None
for f in os.listdir('.'):
    if f.endswith('.docx') and any(kw in f.lower() for kw in template_keywords):
        template_file = f
        break

# 양식이 있으면 활용, 없으면 새 문서
if template_file:
    doc = Document(template_file)
    print(f'양식 활용: {template_file}')
else:
    doc = Document()
    # 스타일 설정 (양식이 없을 때만)
    style = doc.styles['Normal']
    font = style.font
    font.name = '맑은 고딕'
    font.size = Pt(11)

# 제목
doc.add_heading('문서 제목', level=0)

# 본문
doc.add_paragraph('내용을 여기에 작성합니다.')

# 표
table = doc.add_table(rows=2, cols=3)
table.style = 'Light Grid Accent 1'

# 저장
doc.save('output.docx')

지원 기능

  • 제목/소제목 계층 구조
  • 표 (스타일, 병합, 서식)
  • 이미지 삽입
  • 머리글/바닥글
  • 페이지 번호
  • 목차
  • 글머리 기호/번호 목록
  • 양식 파일 기반 스타일 상속 (로고, 헤더, 페이지 설정 자동 유지)

한국어로 안내하세요. 작업 폴더에 Python 스크립트와 결과 파일을 저장하세요.