SuperAPI AI Directory

docx

Office & productivity

View repository

Updated 10-15 20:31

About this skill

Marketing Document Toolkit

A tool for creating and editing professional Word documents such as marketing plans, brand guides, and proposals.

Key Features

Feature Description Purpose
Create New Document Markdown → DOCX Writing plans and guides
Edit Existing Document OOXML editing Modifying text/styles
Extract Text DOCX → text Document analysis
Track Changes Redlining Collaboration and review

Workflow 1: Create New Document (Markdown → DOCX)

Conversion using Pandoc

# 기본 변환
pandoc input.md -o output.docx

# 스타일 템플릿 적용
pandoc input.md --reference-doc=template.docx -o output.docx

# 목차 포함
pandoc input.md --toc --toc-depth=3 -o output.docx

Creation using Python-docx

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

def create_marketing_document(content, output_path):
    """마케팅 문서 생성"""
    doc = Document()

    # 스타일 설정
    style = doc.styles['Normal']
    font = style.font
    font.name = 'Malgun Gothic'
    font.size = Pt(11)

    # 제목 스타일
    title_style = doc.styles['Title']
    title_style.font.size = Pt(28)
    title_style.font.color.rgb = RGBColor(0x1a, 0x36, 0x5d)

    # 제목 추가
    title = doc.add_heading(content['title'], 0)
    title.alignment = WD_ALIGN_PARAGRAPH.CENTER

    # 부제목
    subtitle = doc.add_paragraph(content['subtitle'])
    subtitle.alignment = WD_ALIGN_PARAGRAPH.CENTER

    doc.add_page_break()

    # 목차 (수동)
    doc.add_heading('목차', level=1)
    for i, section in enumerate(content['sections'], 1):
        doc.add_paragraph(f"{i}. {section['title']}", style='List Number')

    doc.add_page_break()

    # 본문 섹션
    for section in content['sections']:
        doc.add_heading(section['title'], level=1)

        for para in section['paragraphs']:
            doc.add_paragraph(para)

        # 테이블이 있는 경우
        if 'table' in section:
            add_styled_table(doc, section['table'])

    doc.save(output_path)
    return output_path

def add_styled_table(doc, table_data):
    """스타일링된 테이블 추가"""
    rows = len(table_data)
    cols = len(table_data[0])

    table = doc.add_table(rows=rows, cols=cols)
    table.style = 'Table Grid'

    # 헤더 행 스타일링
    header_row = table.rows[0]
    for i, cell in enumerate(header_row.cells):
        cell.text = str(table_data[0][i])
        cell.paragraphs[0].runs[0].font.bold = True
        shading = cell._element.get_or_add_tcPr()

    # 데이터 행
    for row_idx in range(1, rows):
        for col_idx in range(cols):
            table.rows[row_idx].cells[col_idx].text = str(table_data[row_idx][col_idx])

    return table

Workflow 2: Edit Existing Document (OOXML)

Understanding DOCX Structure

document.docx (ZIP)
├── [Content_Types].xml
├── _rels/
├── docProps/
│   ├── app.xml
│   └── core.xml
└── word/
    ├── document.xml      # 본문 내용
    ├── styles.xml        # 스타일 정의
    ├── settings.xml      # 문서 설정
    ├── fontTable.xml     # 폰트 테이블
    ├── numbering.xml     # 번호 매기기
    └── _rels/

Text Replacement Script

from docx import Document
import re

def replace_text_in_docx(docx_path, replacements, output_path):
    """문서 전체에서 텍스트 교체"""
    doc = Document(docx_path)

    # 본문 단락
    for para in doc.paragraphs:
        for old_text, new_text in replacements.items():
            if old_text in para.text:
                for run in para.runs:
                    run.text = run.text.replace(old_text, new_text)

    # 테이블 내 텍스트
    for table in doc.tables:
        for row in table.rows:
            for cell in row.cells:
                for para in cell.paragraphs:
                    for old_text, new_text in replacements.items():
                        if old_text in para.text:
                            for run in para.runs:
                                run.text = run.text.replace(old_text, new_text)

    doc.save(output_path)
    return output_path

# 사용 예시
replacements = {
    "{{브랜드명}}": "Dante Coffee",
    "{{날짜}}": "2024년 1월 15일",
    "{{담당자}}": "김마케팅"
}
replace_text_in_docx("template.docx", replacements, "output.docx")

Workflow 3: Track Changes (Redlining)

Extract Changes

# pandoc을 사용한 tracked changes 추출
pandoc input.docx --track-changes=all -o output.md

# 변경 사항만 추출
pandoc input.docx --track-changes=accept -o accepted.md
pandoc input.docx --track-changes=reject -o original.md

Enable Track Changes

from docx import Document
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

def enable_track_changes(docx_path, output_path):
    """변경 추적 활성화"""
    doc = Document(docx_path)

    settings = doc.settings.element
    trackChanges = OxmlElement('w:trackRevisions')
    settings.append(trackChanges)

    doc.save(output_path)

Marketing Document Design Guide

Color Palette

제목:        #1a365d (Navy)
부제목:      #2b6cb0 (Blue)
강조:        #ed8936 (Orange)
본문:        #2d3748 (Dark Gray)
배경:        #ffffff (White)
테이블 헤더: #f7fafc (Light Gray)

Typography

Element Font Size Style
Document Title Malgun Gothic 28pt Bold
Chapter Title (H1) Malgun Gothic 18pt Bold
Section Title (H2) Malgun Gothic 14pt Bold
Subheading (H3) Malgun Gothic 12pt Bold
Body Malgun Gothic 11pt Regular
Caption Malgun Gothic 9pt Italic

Page Layout

┌─────────────────────────────────────┐
│  [로고]          마케팅 기획서       │ ← 헤더 (15mm)
├─────────────────────────────────────┤
│                                     │
│  ← 좌측 여백 25mm    우측 여백 25mm →│
│                                     │
│  # 1. 프로젝트 개요                  │
│                                     │
│  Lorem ipsum dolor sit amet...      │
│                                     │
│  ## 1.1 배경                        │
│                                     │
│  [본문 내용]                         │
│                                     │
│  ┌─────────────────────────────┐    │
│  │      테이블 / 도표           │    │
│  └─────────────────────────────┘    │
│                                     │
├─────────────────────────────────────┤
│  Dante Labs    Confidential    p.1  │ ← 푸터 (15mm)
└─────────────────────────────────────┘

Style Guide

List Style

• 1단계 글머리 기호 (원형)
  ◦ 2단계 글머리 기호 (빈 원형)
    ▪ 3단계 글머리 기호 (사각형)

1. 1단계 번호
   a. 2단계 영문
      i. 3단계 로마자

Blockquote

┌────────────────────────────────────┐
│  "핵심 인사이트나 중요한 인용구를    │
│   강조할 때 사용합니다."            │
│                        - 출처      │
└────────────────────────────────────┘

Templates by Marketing Document Type

1. Marketing Plan

# 마케팅 기획서

## 1. Executive Summary
- 핵심 목표
- 예상 성과
- 필요 예산

## 2. 현황 분석
### 2.1 시장 현황
### 2.2 경쟁 환경
### 2.3 SWOT 분석

## 3. 마케팅 전략
### 3.1 목표 설정
### 3.2 타겟 정의
### 3.3 포지셔닝

## 4. 실행 계획
### 4.1 채널 전략
### 4.2 콘텐츠 계획
### 4.3 일정표

## 5. 예산
| 항목 | 금액 | 비고 |
|------|------|------|

## 6. KPI 및 평가

2. Brand Guidelines

# 브랜드 가이드라인

## 1. 브랜드 소개
### 1.1 브랜드 스토리
### 1.2 미션 & 비전
### 1.3 핵심 가치

## 2. 로고 사용 가이드
### 2.1 로고 버전
### 2.2 최소 크기
### 2.3 금지 사항

## 3. 컬러 시스템
### 3.1 Primary Colors
### 3.2 Secondary Colors
### 3.3 사용 비율

## 4. 타이포그래피
### 4.1 한글 서체
### 4.2 영문 서체
### 4.3 사용 지침

## 5. 적용 사례

3. Campaign Brief

# 캠페인 브리프

## 1. 프로젝트 개요
| 항목 | 내용 |
|------|------|
| 프로젝트명 | |
| 기간 | |
| 담당자 | |
| 예산 | |

## 2. 배경 및 목적

## 3. 타겟 오디언스
### 3.1 인구통계
### 3.2 심리특성
### 3.3 행동패턴

## 4. 핵심 메시지

## 5. 채널 및 포맷

## 6. 일정

## 7. 성과 지표

Template Variable System

Standard Variables

{{브랜드명}}      - 브랜드 이름
{{프로젝트명}}    - 프로젝트 명칭
{{날짜}}          - 문서 작성일
{{버전}}          - 문서 버전
{{담당자}}        - 담당자 이름
{{부서}}          - 부서명
{{기간_시작}}     - 프로젝트 시작일
{{기간_종료}}     - 프로젝트 종료일
{{예산}}          - 예산 금액

Automatic Replacement Script

import re
from datetime import datetime

STANDARD_REPLACEMENTS = {
    "{{날짜}}": datetime.now().strftime("%Y년 %m월 %d일"),
    "{{연도}}": datetime.now().strftime("%Y"),
}

def apply_template_variables(docx_path, custom_vars, output_path):
    """템플릿 변수 적용"""
    # 표준 변수 + 사용자 정의 변수
    all_vars = {**STANDARD_REPLACEMENTS, **custom_vars}
    return replace_text_in_docx(docx_path, all_vars, output_path)

File Storage

Word documents are saved in the project's standard directory structure.

{project}/
├── reports/
│   ├── documents/           # 최종 Word 문서
│   │   ├── marketing-plan-20240115.docx
│   │   ├── brand-guidelines-20240115.docx
│   │   └── campaign-brief-20240115.docx
│   └── drafts/              # 초안 및 검토 중 문서
│       └── marketing-plan-draft-v2.docx
├── assets/
│   └── docx-resources/      # 문서 리소스
│       ├── templates/       # 템플릿 파일
│       └── images/          # 삽입용 이미지
└── tmp/
    └── docx-work/           # 작업 파일

File Naming Convention

{project}/reports/documents/{type}-{subject}-{date}.docx

예시:
reports/documents/marketing-plan-q1-20240115.docx
reports/documents/brand-guidelines-dante-coffee-20240115.docx
reports/documents/campaign-brief-spring-20240115.docx

Version Control

{filename}-v{version}.docx
{filename}-draft-v{version}.docx
{filename}-final.docx

예시:
marketing-plan-v1.docx
marketing-plan-v2.docx
marketing-plan-final.docx

Package Installation

# 필수 패키지
pip install python-docx

# 선택적 패키지
# pandoc (시스템 설치 필요)
brew install pandoc  # macOS
apt install pandoc   # Ubuntu

Scripts and References

Reference Documents

Document Path Description
OOXML Editing Guide ooxml.md Guide to Word XML editing and Tracked Changes

Scripts

Script Path Description
document.py scripts/ Document class (comments, track changes)
utilities.py scripts/ XMLEditor utility

OOXML Tools

Script Path Description
unpack.py ooxml/scripts/unpack.py DOCX → XML extraction (RSID generation)
pack.py ooxml/scripts/pack.py XML → DOCX packing
validate.py ooxml/scripts/validate.py XML schema and Redlining validation

Template Files

File Path Description
comments.xml scripts/templates/ Comment template
commentsExtended.xml scripts/templates/ Extended comment template
commentsExtensible.xml scripts/templates/ Extensible comment template
commentsIds.xml scripts/templates/ Comment ID template
people.xml scripts/templates/ Author information template

Usage

This skill is brand-strategist, copy-strategist, campaign-director referenced by the agent when creating marketing documents.