Overview

Word Processing tools provide advanced capabilities for working with Microsoft Word documents (.docx). These tools enable text highlighting, content modification, and document formatting with support for multiple languages including Japanese, Chinese, and other international character sets.

Key Features

WORD_TEXT_HIGHLIGHT

  • Apply colored highlights to specific text in .docx files
  • Support for multiple highlight colors
  • International character encoding support
  • Precise text matching and highlighting
  • Preserve document formatting and structure

Authentication

No authentication required for Word processing tools.

Example: Document Review and Highlighting

- id: upload_document
  name: upload_document
  tool: INPUT_FILE
  input:
    - name: description
      value: "Upload Word document for review and highlighting"

- id: highlight_key_terms
  name: highlight_key_terms
  tool: WORD_TEXT_HIGHLIGHT
  input:
    - name: file_url
      value: "{{steps.upload_document.result.file_url}}"
    - name: highlights
      value: |
        [
          {
            "text": "important",
            "color": "yellow",
            "case_sensitive": false
          },
          {
            "text": "urgent",
            "color": "red",
            "case_sensitive": false
          },
          {
            "text": "deadline",
            "color": "orange",
            "case_sensitive": false
          },
          {
            "text": "action required",
            "color": "green",
            "case_sensitive": false
          }
        ]

- id: save_highlighted_document
  name: save_highlighted_document
  tool: OUTPUT_FILE
  input:
    - name: content
      value: "{{steps.highlight_key_terms.result.file_content}}"
    - name: filename
      value: "reviewed_document_{{date | format('YYYY-MM-DD')}}.docx"
    - name: fileType
      value: "docx"

Example: Contract Review Workflow

- id: input_contract
  name: input_contract
  tool: INPUT_FILE
  input:
    - name: description
      value: "Upload contract document for legal review"

- id: extract_contract_text
  name: extract_contract_text
  tool: DOCX_EXTRACT_TEXT
  input:
    - name: file_url
      value: "{{steps.input_contract.result.file_url}}"

- id: identify_key_clauses
  name: identify_key_clauses
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Analyze this contract and identify key clauses that should be highlighted:
        
        {{steps.extract_contract_text.result.text}}
        
        Please identify and return:
        1. Critical terms that need immediate attention (RED highlights)
        2. Important financial terms (YELLOW highlights)
        3. Deadlines and dates (ORANGE highlights)
        4. Termination clauses (BLUE highlights)
        5. Liability limitations (GREEN highlights)
        
        Return as JSON array with text, color, and importance level.

- id: apply_legal_highlights
  name: apply_legal_highlights
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        import json
        import re
        
        # Parse AI recommendations
        ai_response = """{{steps.identify_key_clauses.result.content}}"""
        
        # Define standard legal term highlights
        legal_highlights = [
            {"text": "termination", "color": "blue", "case_sensitive": False},
            {"text": "liability", "color": "green", "case_sensitive": False},
            {"text": "indemnification", "color": "green", "case_sensitive": False},
            {"text": "breach", "color": "red", "case_sensitive": False},
            {"text": "default", "color": "red", "case_sensitive": False},
            {"text": "payment", "color": "yellow", "case_sensitive": False},
            {"text": "due date", "color": "orange", "case_sensitive": False},
            {"text": "force majeure", "color": "purple", "case_sensitive": False},
            {"text": "confidential", "color": "cyan", "case_sensitive": False},
            {"text": "intellectual property", "color": "magenta", "case_sensitive": False}
        ]
        
        print(json.dumps(legal_highlights, indent=2))

- id: highlight_contract_terms
  name: highlight_contract_terms
  tool: WORD_TEXT_HIGHLIGHT
  input:
    - name: file_url
      value: "{{steps.input_contract.result.file_url}}"
    - name: highlights
      value: "{{steps.apply_legal_highlights.result.stdout}}"

- id: create_review_summary
  name: create_review_summary
  tool: OUTPUT_FILE
  input:
    - name: content
      value: |
        Contract Review Summary
        ======================
        
        Document: {{steps.input_contract.input.description}}
        Review Date: {{date | format('YYYY-MM-DD HH:mm:ss')}}
        
        Highlighting Legend:
        - RED: Critical terms requiring immediate attention
        - YELLOW: Financial terms and payment obligations  
        - ORANGE: Deadlines and important dates
        - BLUE: Termination and ending clauses
        - GREEN: Liability and indemnification terms
        - PURPLE: Force majeure and exceptional circumstances
        - CYAN: Confidentiality and privacy terms
        - MAGENTA: Intellectual property clauses
        
        Key Findings:
        {{steps.identify_key_clauses.result.content}}
        
        Recommendations:
        1. Review all RED highlighted terms with legal counsel
        2. Verify all ORANGE highlighted dates are accurate
        3. Ensure YELLOW highlighted financial terms are acceptable
        4. Confirm BLUE highlighted termination conditions
        
        Next Steps:
        - Legal team review required
        - Stakeholder approval needed
        - Client signature pending
    - name: filename
      value: "contract_review_summary_{{date | format('YYYY-MM-DD')}}.txt"
    - name: fileType
      value: "txt"

Example: Multi-language Document Processing

- id: upload_multilingual_doc
  name: upload_multilingual_doc
  tool: INPUT_FILE
  input:
    - name: description
      value: "Upload document with Japanese/Chinese text"

- id: highlight_multilingual_terms
  name: highlight_multilingual_terms
  tool: WORD_TEXT_HIGHLIGHT
  input:
    - name: file_url
      value: "{{steps.upload_multilingual_doc.result.file_url}}"
    - name: highlights
      value: |
        [
          {
            "text": "重要",
            "color": "red",
            "case_sensitive": false,
            "description": "Important (Japanese)"
          },
          {
            "text": "緊急",
            "color": "orange", 
            "case_sensitive": false,
            "description": "Urgent (Japanese)"
          },
          {
            "text": "注意",
            "color": "yellow",
            "case_sensitive": false,
            "description": "Attention (Japanese)"
          },
          {
            "text": "重要",
            "color": "red",
            "case_sensitive": false,
            "description": "Important (Chinese)"
          },
          {
            "text": "截止日期",
            "color": "orange",
            "case_sensitive": false,
            "description": "Deadline (Chinese)"
          }
        ]

- id: process_highlighted_content
  name: process_highlighted_content
  tool: GEMINI_INVOKE_WITH_FILE
  config:
    - name: version
      value: gemini-1.5-flash
    - name: token
      value: "{{secrets.GEMINI_API_KEY}}"
  input:
    - name: prompt
      value: |
        Please analyze this highlighted multilingual document and:
        1. Identify all highlighted text sections
        2. Provide English translations for highlighted terms
        3. Summarize the key points by highlight color
        4. Note any critical information that requires attention
    - name: file_url
      value: "{{steps.highlight_multilingual_terms.result.file_url}}"

Example: Educational Content Highlighting

- id: upload_study_material
  name: upload_study_material
  tool: INPUT_FILE
  input:
    - name: description
      value: "Upload educational document for highlighting"

- id: identify_study_points
  name: identify_study_points
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Analyze this educational content and categorize text for highlighting:
        
        {{steps.extract_text.result.text}}
        
        Categories:
        1. Key concepts and definitions (YELLOW)
        2. Important formulas or equations (GREEN) 
        3. Critical facts and dates (BLUE)
        4. Examples and case studies (PURPLE)
        5. Warning or caution notes (RED)
        
        Return specific text phrases to highlight in each category.

- id: create_study_highlights
  name: create_study_highlights
  tool: PYTHON_SANDBOX_RUN
  input:
    - name: code
      value: |
        # Create educational highlight scheme
        study_highlights = [
            # Key terms and definitions
            {"text": "definition", "color": "yellow", "case_sensitive": False},
            {"text": "theorem", "color": "yellow", "case_sensitive": False},
            {"text": "principle", "color": "yellow", "case_sensitive": False},
            
            # Formulas and equations
            {"text": "formula", "color": "green", "case_sensitive": False},
            {"text": "equation", "color": "green", "case_sensitive": False},
            {"text": "calculate", "color": "green", "case_sensitive": False},
            
            # Important facts
            {"text": "important", "color": "blue", "case_sensitive": False},
            {"text": "note that", "color": "blue", "case_sensitive": False},
            {"text": "remember", "color": "blue", "case_sensitive": False},
            
            # Examples
            {"text": "example", "color": "purple", "case_sensitive": False},
            {"text": "case study", "color": "purple", "case_sensitive": False},
            {"text": "for instance", "color": "purple", "case_sensitive": False},
            
            # Warnings and cautions
            {"text": "warning", "color": "red", "case_sensitive": False},
            {"text": "caution", "color": "red", "case_sensitive": False},
            {"text": "avoid", "color": "red", "case_sensitive": False}
        ]
        
        import json
        print(json.dumps(study_highlights, indent=2))

- id: apply_study_highlights
  name: apply_study_highlights
  tool: WORD_TEXT_HIGHLIGHT
  input:
    - name: file_url
      value: "{{steps.upload_study_material.result.file_url}}"
    - name: highlights
      value: "{{steps.create_study_highlights.result.stdout}}"

- id: create_study_guide
  name: create_study_guide
  tool: OUTPUT_FILE
  input:
    - name: content
      value: |
        Study Guide - Highlighting Legend
        ================================
        
        Color Coding System:
        
        🟡 YELLOW - Key Concepts & Definitions
        - Fundamental terms and concepts
        - Important definitions to memorize
        - Core principles and theories
        
        🟢 GREEN - Formulas & Equations  
        - Mathematical formulas
        - Calculation methods
        - Problem-solving approaches
        
        🔵 BLUE - Critical Facts & Information
        - Important facts to remember
        - Key points for exams
        - Essential knowledge items
        
        🟣 PURPLE - Examples & Case Studies
        - Practical examples
        - Real-world applications
        - Case study references
        
        🔴 RED - Warnings & Cautions
        - Common mistakes to avoid
        - Important warnings
        - Critical safety information
        
        Study Tips:
        1. Focus on YELLOW highlighted definitions first
        2. Practice GREEN highlighted formulas
        3. Memorize BLUE highlighted facts
        4. Review PURPLE highlighted examples
        5. Pay special attention to RED highlighted warnings
        
        Document processed: {{date | format('YYYY-MM-DD HH:mm:ss')}}
    - name: filename
      value: "study_guide_{{date | format('YYYY-MM-DD')}}.txt"
    - name: fileType
      value: "txt"

Highlight Color Options

ColorRGB CodeUse Case
yellow#FFFF00Key concepts, definitions
red#FF0000Critical items, warnings
green#00FF00Formulas, calculations
blue#0000FFImportant facts, dates
orange#FFA500Deadlines, urgent items
purple#800080Examples, case studies
cyan#00FFFFNotes, references
magenta#FF00FFSpecial categories

Text Matching Options

Case Sensitivity

  • case_sensitive: true - Exact case match required
  • case_sensitive: false - Case-insensitive matching (default)

Pattern Matching

  • Exact phrase matching
  • Partial word matching
  • Regex support for complex patterns

Use Cases

  • Document Review: Legal contracts, technical specifications
  • Educational Materials: Textbooks, study guides, training materials
  • Content Categorization: Organize information by importance
  • Quality Assurance: Highlight issues, corrections, improvements
  • Collaboration: Mark sections for team review
  • Compliance: Highlight regulatory requirements
  • Translation: Mark text for translation or localization
  • Research: Categorize findings and key insights

Best Practices

Highlight Strategy

  • Use consistent color coding across documents
  • Create highlight legends for team collaboration
  • Limit colors to avoid visual confusion
  • Test highlighting on sample text first

International Support

  • Verify encoding compatibility for non-Latin characters
  • Test with multilingual content before bulk processing
  • Consider right-to-left text direction for Arabic/Hebrew
  • Use Unicode-compatible text matching

Performance Optimization

  • Process large documents in sections
  • Use specific text matching to reduce processing time
  • Batch similar highlighting operations
  • Monitor file size after highlighting