[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M729YRJAZEGHBXA4XKMQDETN":3,"skill-same:01M729YRJAZEGHBXA4XKMQDETN":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":48,"commitSha":49,"skillDirectory":5,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M729YRJAZEGHBXA4XKMQDETN","batch-convert",null,"Batch convert documents between multiple formats using a unified pipeline","claude-office-skills\u002Fskills","claude-office-skills","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F258027507?v=4","01M729XQC9FBRQ54AQZS0KY3ZK","AGI Lab","01M729XQCYW6WF9GY762P9RNQJ",575,"MIT","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fbatch-convert\u002FSKILL.md",[],[],"2026-11-10 18:39:20",false,"---\n# ═══════════════════════════════════════════════════════════════════════════════\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# ═══════════════════════════════════════════════════════════════════════════════\n\n# Basic Information\nname: batch-convert\ndescription: \"Batch convert documents between multiple formats using a unified pipeline\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: conversion\ntags:\n  - batch\n  - conversion\n  - bulk\n  - automation\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - batch_convert\n\n# Skill Capabilities\ncapabilities:\n  - bulk_conversion\n  - automation\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# Batch Convert Skill\n\n## Overview\n\nThis skill enables batch conversion of documents between multiple formats using a unified pipeline. Convert hundreds of files at once with consistent settings, automatic format detection, and parallel processing for maximum efficiency.\n\n## How to Use\n\n1. Specify the source folder or files\n2. Choose target format(s)\n3. Optionally configure conversion options\n4. I'll process all files with progress tracking\n\n**Example prompts:**\n- \"Convert all PDFs in this folder to Word documents\"\n- \"Batch convert these markdown files to PDF and HTML\"\n- \"Process all Office files and convert to Markdown\"\n- \"Convert this folder of images to a single PDF\"\n\n## Domain Knowledge\n\n### Supported Format Matrix\n\n| From | To: DOCX | To: PDF | To: MD | To: HTML | To: PPTX |\n|------|----------|---------|--------|----------|----------|\n| DOCX | - | ✅ | ✅ | ✅ | - |\n| PDF | ✅ | - | ✅ | ✅ | - |\n| MD | ✅ | ✅ | - | ✅ | ✅ |\n| HTML | ✅ | ✅ | ✅ | - | - |\n| XLSX | - | ✅ | ✅ | ✅ | - |\n| PPTX | - | ✅ | ✅ | ✅ | - |\n\n### Core Pipeline\n\n```python\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nimport subprocess\nimport os\n\nclass DocumentConverter:\n    \"\"\"Unified document conversion pipeline.\"\"\"\n    \n    def __init__(self, max_workers=4):\n        self.max_workers = max_workers\n        self.converters = {\n            ('md', 'docx'): self._md_to_docx,\n            ('md', 'pdf'): self._md_to_pdf,\n            ('md', 'html'): self._md_to_html,\n            ('md', 'pptx'): self._md_to_pptx,\n            ('docx', 'pdf'): self._docx_to_pdf,\n            ('docx', 'md'): self._docx_to_md,\n            ('pdf', 'docx'): self._pdf_to_docx,\n            ('pdf', 'md'): self._pdf_to_md,\n            ('xlsx', 'pdf'): self._xlsx_to_pdf,\n            ('xlsx', 'md'): self._xlsx_to_md,\n            ('pptx', 'pdf'): self._pptx_to_pdf,\n            ('pptx', 'md'): self._pptx_to_md,\n            ('html', 'md'): self._html_to_md,\n            ('html', 'pdf'): self._html_to_pdf,\n        }\n    \n    def convert(self, input_path, output_format, output_dir=None):\n        \"\"\"Convert single file to target format.\"\"\"\n        input_path = Path(input_path)\n        input_format = input_path.suffix[1:].lower()\n        \n        if output_dir:\n            output_path = Path(output_dir) \u002F f\"{input_path.stem}.{output_format}\"\n        else:\n            output_path = input_path.with_suffix(f\".{output_format}\")\n        \n        converter_key = (input_format, output_format)\n        if converter_key not in self.converters:\n            raise ValueError(f\"Conversion not supported: {input_format} -> {output_format}\")\n        \n        converter = self.converters[converter_key]\n        return converter(input_path, output_path)\n    \n    def batch_convert(self, input_dir, output_format, output_dir=None, \n                      file_pattern=\"*\", recursive=False):\n        \"\"\"Batch convert all matching files.\"\"\"\n        input_path = Path(input_dir)\n        output_path = Path(output_dir) if output_dir else input_path \u002F \"converted\"\n        output_path.mkdir(exist_ok=True)\n        \n        # Find files\n        if recursive:\n            files = list(input_path.rglob(file_pattern))\n        else:\n            files = list(input_path.glob(file_pattern))\n        \n        # Filter to supported formats\n        supported_ext = ['.md', '.docx', '.pdf', '.xlsx', '.pptx', '.html']\n        files = [f for f in files if f.suffix.lower() in supported_ext]\n        \n        results = []\n        \n        with ThreadPoolExecutor(max_workers=self.max_workers) as executor:\n            future_to_file = {\n                executor.submit(self.convert, f, output_format, output_path): f\n                for f in files\n            }\n            \n            for future in as_completed(future_to_file):\n                file = future_to_file[future]\n                try:\n                    result = future.result()\n                    results.append({'file': str(file), 'status': 'success', 'output': str(result)})\n                except Exception as e:\n                    results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n        \n        return results\n```\n\n### Converter Implementations\n\n```python\n# Markdown conversions (using Pandoc)\ndef _md_to_docx(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pdf(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_html(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-s', '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pptx(self, input_path, output_path):\n    subprocess.run(['marp', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\n# Office to Markdown (using markitdown)\ndef _docx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _xlsx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _pptx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# PDF conversions\ndef _pdf_to_docx(self, input_path, output_path):\n    from pdf2docx import Converter\n    cv = Converter(str(input_path))\n    cv.convert(str(output_path))\n    cv.close()\n    return output_path\n\ndef _pdf_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# Office to PDF (using LibreOffice)\ndef _docx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _xlsx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _pptx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n```\n\n### Progress Tracking\n\n```python\nfrom tqdm import tqdm\n\ndef batch_convert_with_progress(converter, input_dir, output_format, output_dir=None):\n    \"\"\"Batch convert with progress bar.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    results = []\n    for file in tqdm(files, desc=f\"Converting to {output_format}\"):\n        try:\n            result = converter.convert(file, output_format, output_dir)\n            results.append({'file': str(file), 'status': 'success'})\n        except Exception as e:\n            results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n    \n    return results\n```\n\n## Best Practices\n\n1. **Test Sample First**: Convert a few files before batch processing\n2. **Check Disk Space**: Ensure sufficient space for output\n3. **Use Parallel Processing**: Speed up with multiple workers\n4. **Handle Errors Gracefully**: Log failures, continue processing\n5. **Verify Output**: Spot-check converted files\n\n## Common Patterns\n\n### Format Detection Pipeline\n```python\ndef detect_and_convert(file_path, target_format):\n    \"\"\"Automatically detect format and convert.\"\"\"\n    import mimetypes\n    \n    mime_type, _ = mimetypes.guess_type(str(file_path))\n    \n    format_map = {\n        'application\u002Fpdf': 'pdf',\n        'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n        'application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',\n        'application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',\n        'text\u002Fmarkdown': 'md',\n        'text\u002Fhtml': 'html',\n    }\n    \n    source_format = format_map.get(mime_type, Path(file_path).suffix[1:])\n    \n    converter = DocumentConverter()\n    return converter.convert(file_path, target_format)\n```\n\n### Multi-Format Output\n```python\ndef convert_to_multiple_formats(input_file, output_formats, output_dir):\n    \"\"\"Convert one file to multiple formats.\"\"\"\n    converter = DocumentConverter()\n    results = {}\n    \n    for fmt in output_formats:\n        try:\n            output = converter.convert(input_file, fmt, output_dir)\n            results[fmt] = {'status': 'success', 'path': str(output)}\n        except Exception as e:\n            results[fmt] = {'status': 'error', 'error': str(e)}\n    \n    return results\n\n# Convert README to multiple formats\nresults = convert_to_multiple_formats(\n    'README.md',\n    ['docx', 'pdf', 'html'],\n    '.\u002Fexports'\n)\n```\n\n## Examples\n\n### Example 1: Documentation Export\n```python\nfrom pathlib import Path\nimport json\n\ndef export_documentation(docs_dir, export_dir):\n    \"\"\"Export all documentation to multiple formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=8)\n    docs_path = Path(docs_dir)\n    export_path = Path(export_dir)\n    \n    # Create format directories\n    for fmt in ['pdf', 'docx', 'html']:\n        (export_path \u002F fmt).mkdir(parents=True, exist_ok=True)\n    \n    all_results = {}\n    \n    # Find all markdown files\n    md_files = list(docs_path.rglob('*.md'))\n    \n    for md_file in md_files:\n        file_results = {}\n        \n        for fmt in ['pdf', 'docx', 'html']:\n            output_dir = export_path \u002F fmt\n            try:\n                output = converter.convert(md_file, fmt, output_dir)\n                file_results[fmt] = 'success'\n            except Exception as e:\n                file_results[fmt] = f'error: {e}'\n        \n        all_results[str(md_file)] = file_results\n        print(f\"Processed: {md_file.name}\")\n    \n    # Save report\n    with open(export_path \u002F 'export_report.json', 'w') as f:\n        json.dump(all_results, f, indent=2)\n    \n    return all_results\n\nresults = export_documentation('.\u002Fdocs', '.\u002Fexports')\n```\n\n### Example 2: Legacy Document Migration\n```python\ndef migrate_legacy_docs(source_dir, target_dir):\n    \"\"\"Migrate legacy documents to modern formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=4)\n    \n    # Migration rules\n    migrations = [\n        ('*.doc', 'docx'),   # Old Word to new\n        ('*.xls', 'xlsx'),   # Old Excel to new\n        ('*.ppt', 'pptx'),   # Old PowerPoint to new\n        ('*.rtf', 'docx'),   # RTF to Word\n    ]\n    \n    source_path = Path(source_dir)\n    target_path = Path(target_dir)\n    target_path.mkdir(exist_ok=True)\n    \n    total_migrated = 0\n    errors = []\n    \n    for pattern, target_format in migrations:\n        files = list(source_path.glob(pattern))\n        \n        for file in files:\n            try:\n                # Use LibreOffice for legacy formats\n                subprocess.run([\n                    'soffice', '--headless',\n                    '--convert-to', target_format,\n                    '--outdir', str(target_path),\n                    str(file)\n                ], check=True)\n                \n                total_migrated += 1\n                print(f\"Migrated: {file.name}\")\n                \n            except Exception as e:\n                errors.append({'file': str(file), 'error': str(e)})\n    \n    print(f\"\\nMigration complete: {total_migrated} files\")\n    print(f\"Errors: {len(errors)}\")\n    \n    return {'migrated': total_migrated, 'errors': errors}\n```\n\n### Example 3: Report Generation Pipeline\n```python\ndef generate_reports_pipeline(data_files, template_dir, output_dir):\n    \"\"\"Generate reports from data files using templates.\"\"\"\n    \n    from datetime import datetime\n    \n    converter = DocumentConverter()\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')\n    \n    reports = []\n    \n    for data_file in data_files:\n        # Load data\n        data_path = Path(data_file)\n        \n        # Generate markdown report\n        md_content = f\"\"\"---\ntitle: Report - {data_path.stem}\ndate: {datetime.now().strftime('%Y-%m-%d')}\n---\n\n# {data_path.stem} Report\n\nGenerated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n## Data Summary\n\n\"\"\"\n        \n        # Add data content (simplified)\n        if data_path.suffix == '.xlsx':\n            from markitdown import MarkItDown\n            md = MarkItDown()\n            result = md.convert(str(data_path))\n            md_content += result.text_content\n        \n        # Save markdown\n        md_file = output_path \u002F f\"{data_path.stem}_{timestamp}.md\"\n        with open(md_file, 'w') as f:\n            f.write(md_content)\n        \n        # Convert to PDF and DOCX\n        for fmt in ['pdf', 'docx']:\n            try:\n                output = converter.convert(md_file, fmt, output_path)\n                reports.append({'source': str(data_file), 'output': str(output), 'format': fmt})\n            except Exception as e:\n                print(f\"Error converting {data_file} to {fmt}: {e}\")\n    \n    return reports\n```\n\n## Limitations\n\n- Some format combinations not supported\n- Complex formatting may be lost in conversion\n- Large files may require more time\n- Some conversions need external tools (LibreOffice, Pandoc)\n- Quality varies by source document complexity\n\n## Installation\n\n```bash\n# Core dependencies\npip install pdf2docx markitdown python-docx openpyxl\n\n# Pandoc (for MD conversions)\nbrew install pandoc  # macOS\napt install pandoc   # Ubuntu\n\n# Marp (for PPTX)\nnpm install -g @marp-team\u002Fmarp-cli\n\n# LibreOffice (for Office formats)\nbrew install libreoffice  # macOS\napt install libreoffice   # Ubuntu\n```\n\n## Resources\n\n- [Pandoc Documentation](https:\u002F\u002Fpandoc.org\u002FMANUAL.html)\n- [markitdown GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmarkitdown)\n- [pdf2docx Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [LibreOffice CLI](https:\u002F\u002Fhelp.libreoffice.org\u002Flatest\u002Fen-US\u002Ftext\u002Fshared\u002Fguide\u002Fstart_parameters.html)\n","# Batch Convert Skill\n\n## Overview\n\nThis skill enables batch conversion of documents between multiple formats using a unified pipeline. Convert hundreds of files at once with consistent settings, automatic format detection, and parallel processing for maximum efficiency.\n\n## How to Use\n\n1. Specify the source folder or files\n2. Choose target format(s)\n3. Optionally configure conversion options\n4. I'll process all files with progress tracking\n\n**Example prompts:**\n- \"Convert all PDFs in this folder to Word documents\"\n- \"Batch convert these markdown files to PDF and HTML\"\n- \"Process all Office files and convert to Markdown\"\n- \"Convert this folder of images to a single PDF\"\n\n## Domain Knowledge\n\n### Supported Format Matrix\n\n| From | To: DOCX | To: PDF | To: MD | To: HTML | To: PPTX |\n|------|----------|---------|--------|----------|----------|\n| DOCX | - | ✅ | ✅ | ✅ | - |\n| PDF | ✅ | - | ✅ | ✅ | - |\n| MD | ✅ | ✅ | - | ✅ | ✅ |\n| HTML | ✅ | ✅ | ✅ | - | - |\n| XLSX | - | ✅ | ✅ | ✅ | - |\n| PPTX | - | ✅ | ✅ | ✅ | - |\n\n### Core Pipeline\n\n```python\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\nimport subprocess\nimport os\n\nclass DocumentConverter:\n    \"\"\"Unified document conversion pipeline.\"\"\"\n    \n    def __init__(self, max_workers=4):\n        self.max_workers = max_workers\n        self.converters = {\n            ('md', 'docx'): self._md_to_docx,\n            ('md', 'pdf'): self._md_to_pdf,\n            ('md', 'html'): self._md_to_html,\n            ('md', 'pptx'): self._md_to_pptx,\n            ('docx', 'pdf'): self._docx_to_pdf,\n            ('docx', 'md'): self._docx_to_md,\n            ('pdf', 'docx'): self._pdf_to_docx,\n            ('pdf', 'md'): self._pdf_to_md,\n            ('xlsx', 'pdf'): self._xlsx_to_pdf,\n            ('xlsx', 'md'): self._xlsx_to_md,\n            ('pptx', 'pdf'): self._pptx_to_pdf,\n            ('pptx', 'md'): self._pptx_to_md,\n            ('html', 'md'): self._html_to_md,\n            ('html', 'pdf'): self._html_to_pdf,\n        }\n    \n    def convert(self, input_path, output_format, output_dir=None):\n        \"\"\"Convert single file to target format.\"\"\"\n        input_path = Path(input_path)\n        input_format = input_path.suffix[1:].lower()\n        \n        if output_dir:\n            output_path = Path(output_dir) \u002F f\"{input_path.stem}.{output_format}\"\n        else:\n            output_path = input_path.with_suffix(f\".{output_format}\")\n        \n        converter_key = (input_format, output_format)\n        if converter_key not in self.converters:\n            raise ValueError(f\"Conversion not supported: {input_format} -> {output_format}\")\n        \n        converter = self.converters[converter_key]\n        return converter(input_path, output_path)\n    \n    def batch_convert(self, input_dir, output_format, output_dir=None, \n                      file_pattern=\"*\", recursive=False):\n        \"\"\"Batch convert all matching files.\"\"\"\n        input_path = Path(input_dir)\n        output_path = Path(output_dir) if output_dir else input_path \u002F \"converted\"\n        output_path.mkdir(exist_ok=True)\n        \n        # Find files\n        if recursive:\n            files = list(input_path.rglob(file_pattern))\n        else:\n            files = list(input_path.glob(file_pattern))\n        \n        # Filter to supported formats\n        supported_ext = ['.md', '.docx', '.pdf', '.xlsx', '.pptx', '.html']\n        files = [f for f in files if f.suffix.lower() in supported_ext]\n        \n        results = []\n        \n        with ThreadPoolExecutor(max_workers=self.max_workers) as executor:\n            future_to_file = {\n                executor.submit(self.convert, f, output_format, output_path): f\n                for f in files\n            }\n            \n            for future in as_completed(future_to_file):\n                file = future_to_file[future]\n                try:\n                    result = future.result()\n                    results.append({'file': str(file), 'status': 'success', 'output': str(result)})\n                except Exception as e:\n                    results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n        \n        return results\n```\n\n### Converter Implementations\n\n```python\n# Markdown conversions (using Pandoc)\ndef _md_to_docx(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pdf(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_html(self, input_path, output_path):\n    subprocess.run(['pandoc', str(input_path), '-s', '-o', str(output_path)], check=True)\n    return output_path\n\ndef _md_to_pptx(self, input_path, output_path):\n    subprocess.run(['marp', str(input_path), '-o', str(output_path)], check=True)\n    return output_path\n\n# Office to Markdown (using markitdown)\ndef _docx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _xlsx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\ndef _pptx_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# PDF conversions\ndef _pdf_to_docx(self, input_path, output_path):\n    from pdf2docx import Converter\n    cv = Converter(str(input_path))\n    cv.convert(str(output_path))\n    cv.close()\n    return output_path\n\ndef _pdf_to_md(self, input_path, output_path):\n    from markitdown import MarkItDown\n    md = MarkItDown()\n    result = md.convert(str(input_path))\n    with open(output_path, 'w') as f:\n        f.write(result.text_content)\n    return output_path\n\n# Office to PDF (using LibreOffice)\ndef _docx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _xlsx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n\ndef _pptx_to_pdf(self, input_path, output_path):\n    subprocess.run([\n        'soffice', '--headless', '--convert-to', 'pdf',\n        '--outdir', str(output_path.parent), str(input_path)\n    ], check=True)\n    return output_path\n```\n\n### Progress Tracking\n\n```python\nfrom tqdm import tqdm\n\ndef batch_convert_with_progress(converter, input_dir, output_format, output_dir=None):\n    \"\"\"Batch convert with progress bar.\"\"\"\n    input_path = Path(input_dir)\n    files = list(input_path.glob('*'))\n    \n    results = []\n    for file in tqdm(files, desc=f\"Converting to {output_format}\"):\n        try:\n            result = converter.convert(file, output_format, output_dir)\n            results.append({'file': str(file), 'status': 'success'})\n        except Exception as e:\n            results.append({'file': str(file), 'status': 'error', 'error': str(e)})\n    \n    return results\n```\n\n## Best Practices\n\n1. **Test Sample First**: Convert a few files before batch processing\n2. **Check Disk Space**: Ensure sufficient space for output\n3. **Use Parallel Processing**: Speed up with multiple workers\n4. **Handle Errors Gracefully**: Log failures, continue processing\n5. **Verify Output**: Spot-check converted files\n\n## Common Patterns\n\n### Format Detection Pipeline\n```python\ndef detect_and_convert(file_path, target_format):\n    \"\"\"Automatically detect format and convert.\"\"\"\n    import mimetypes\n    \n    mime_type, _ = mimetypes.guess_type(str(file_path))\n    \n    format_map = {\n        'application\u002Fpdf': 'pdf',\n        'application\u002Fvnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',\n        'application\u002Fvnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',\n        'application\u002Fvnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',\n        'text\u002Fmarkdown': 'md',\n        'text\u002Fhtml': 'html',\n    }\n    \n    source_format = format_map.get(mime_type, Path(file_path).suffix[1:])\n    \n    converter = DocumentConverter()\n    return converter.convert(file_path, target_format)\n```\n\n### Multi-Format Output\n```python\ndef convert_to_multiple_formats(input_file, output_formats, output_dir):\n    \"\"\"Convert one file to multiple formats.\"\"\"\n    converter = DocumentConverter()\n    results = {}\n    \n    for fmt in output_formats:\n        try:\n            output = converter.convert(input_file, fmt, output_dir)\n            results[fmt] = {'status': 'success', 'path': str(output)}\n        except Exception as e:\n            results[fmt] = {'status': 'error', 'error': str(e)}\n    \n    return results\n\n# Convert README to multiple formats\nresults = convert_to_multiple_formats(\n    'README.md',\n    ['docx', 'pdf', 'html'],\n    '.\u002Fexports'\n)\n```\n\n## Examples\n\n### Example 1: Documentation Export\n```python\nfrom pathlib import Path\nimport json\n\ndef export_documentation(docs_dir, export_dir):\n    \"\"\"Export all documentation to multiple formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=8)\n    docs_path = Path(docs_dir)\n    export_path = Path(export_dir)\n    \n    # Create format directories\n    for fmt in ['pdf', 'docx', 'html']:\n        (export_path \u002F fmt).mkdir(parents=True, exist_ok=True)\n    \n    all_results = {}\n    \n    # Find all markdown files\n    md_files = list(docs_path.rglob('*.md'))\n    \n    for md_file in md_files:\n        file_results = {}\n        \n        for fmt in ['pdf', 'docx', 'html']:\n            output_dir = export_path \u002F fmt\n            try:\n                output = converter.convert(md_file, fmt, output_dir)\n                file_results[fmt] = 'success'\n            except Exception as e:\n                file_results[fmt] = f'error: {e}'\n        \n        all_results[str(md_file)] = file_results\n        print(f\"Processed: {md_file.name}\")\n    \n    # Save report\n    with open(export_path \u002F 'export_report.json', 'w') as f:\n        json.dump(all_results, f, indent=2)\n    \n    return all_results\n\nresults = export_documentation('.\u002Fdocs', '.\u002Fexports')\n```\n\n### Example 2: Legacy Document Migration\n```python\ndef migrate_legacy_docs(source_dir, target_dir):\n    \"\"\"Migrate legacy documents to modern formats.\"\"\"\n    \n    converter = DocumentConverter(max_workers=4)\n    \n    # Migration rules\n    migrations = [\n        ('*.doc', 'docx'),   # Old Word to new\n        ('*.xls', 'xlsx'),   # Old Excel to new\n        ('*.ppt', 'pptx'),   # Old PowerPoint to new\n        ('*.rtf', 'docx'),   # RTF to Word\n    ]\n    \n    source_path = Path(source_dir)\n    target_path = Path(target_dir)\n    target_path.mkdir(exist_ok=True)\n    \n    total_migrated = 0\n    errors = []\n    \n    for pattern, target_format in migrations:\n        files = list(source_path.glob(pattern))\n        \n        for file in files:\n            try:\n                # Use LibreOffice for legacy formats\n                subprocess.run([\n                    'soffice', '--headless',\n                    '--convert-to', target_format,\n                    '--outdir', str(target_path),\n                    str(file)\n                ], check=True)\n                \n                total_migrated += 1\n                print(f\"Migrated: {file.name}\")\n                \n            except Exception as e:\n                errors.append({'file': str(file), 'error': str(e)})\n    \n    print(f\"\\nMigration complete: {total_migrated} files\")\n    print(f\"Errors: {len(errors)}\")\n    \n    return {'migrated': total_migrated, 'errors': errors}\n```\n\n### Example 3: Report Generation Pipeline\n```python\ndef generate_reports_pipeline(data_files, template_dir, output_dir):\n    \"\"\"Generate reports from data files using templates.\"\"\"\n    \n    from datetime import datetime\n    \n    converter = DocumentConverter()\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')\n    \n    reports = []\n    \n    for data_file in data_files:\n        # Load data\n        data_path = Path(data_file)\n        \n        # Generate markdown report\n        md_content = f\"\"\"---\ntitle: Report - {data_path.stem}\ndate: {datetime.now().strftime('%Y-%m-%d')}\n---\n\n# {data_path.stem} Report\n\nGenerated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n## Data Summary\n\n\"\"\"\n        \n        # Add data content (simplified)\n        if data_path.suffix == '.xlsx':\n            from markitdown import MarkItDown\n            md = MarkItDown()\n            result = md.convert(str(data_path))\n            md_content += result.text_content\n        \n        # Save markdown\n        md_file = output_path \u002F f\"{data_path.stem}_{timestamp}.md\"\n        with open(md_file, 'w') as f:\n            f.write(md_content)\n        \n        # Convert to PDF and DOCX\n        for fmt in ['pdf', 'docx']:\n            try:\n                output = converter.convert(md_file, fmt, output_path)\n                reports.append({'source': str(data_file), 'output': str(output), 'format': fmt})\n            except Exception as e:\n                print(f\"Error converting {data_file} to {fmt}: {e}\")\n    \n    return reports\n```\n\n## Limitations\n\n- Some format combinations not supported\n- Complex formatting may be lost in conversion\n- Large files may require more time\n- Some conversions need external tools (LibreOffice, Pandoc)\n- Quality varies by source document complexity\n\n## Installation\n\n```bash\n# Core dependencies\npip install pdf2docx markitdown python-docx openpyxl\n\n# Pandoc (for MD conversions)\nbrew install pandoc  # macOS\napt install pandoc   # Ubuntu\n\n# Marp (for PPTX)\nnpm install -g @marp-team\u002Fmarp-cli\n\n# LibreOffice (for Office formats)\nbrew install libreoffice  # macOS\napt install libreoffice   # Ubuntu\n```\n\n## Resources\n\n- [Pandoc Documentation](https:\u002F\u002Fpandoc.org\u002FMANUAL.html)\n- [markitdown GitHub](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmarkitdown)\n- [pdf2docx Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [LibreOffice CLI](https:\u002F\u002Fhelp.libreoffice.org\u002Flatest\u002Fen-US\u002Ftext\u002Fshared\u002Fguide\u002Fstart_parameters.html)\n",{"mcp":24,"name":5,"tags":28,"author":9,"models":33,"license":15,"version":41,"category":30,"languages":42,"department":45,"description":7,"capabilities":46},{"tools":25,"server":27},[26],"batch_convert","office-mcp",[29,30,31,32],"batch","conversion","bulk","automation",{"compatible":34,"recommended":38},[35,36,37],"claude-3-5-sonnet","gpt-4","gpt-4o",[39,40],"claude-sonnet-4","claude-opus-4","1.0",[43,44],"en","zh","All",[47,32],"bulk_conversion","main","9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11",105,"https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills","2026-01-31 22:03:56",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add claude-office-skills\u002Fskills --skill batch-convert",{"tool":60,"command":61},"bunx","bunx skills add claude-office-skills\u002Fskills --skill batch-convert",{"tool":63,"command":64},"pnpm","pnpm dlx skills add claude-office-skills\u002Fskills --skill batch-convert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fbatch-convert\u002FSKILL.md",true,[],[69,76,83,90,97,104],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M72A0X7X4TWS4ZWTEK8TJEC8","devops-automation","DevOps and IT Ops automation - CI\u002FCD, monitoring, incident management, and infrastructure workflows","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdevops-automation\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M72A0VPXF4Q5F48TPDG6S10Q","dev-slides",">","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdev-slides\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M72A0Q1T0KN60CR3PAD93J6T","deep-research","Conduct comprehensive research on any topic. Synthesize information from multiple angles, provide structured analysis, and generate detailed research reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdeep-research\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M72A0KWAYEWQJMDRGC0WTT7V","dcf-valuation","Build Discounted Cash Flow (DCF) valuation models. Calculate intrinsic value with customizable assumptions. Generate professional valuation reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdcf-valuation\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M72A0GVWRZ3HZNXMW3RB5CF9","Database Sync","Automate database synchronization, replication, migration, and cross-platform data integration","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdatabase-sync\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M72A0E16K862EDP0QYEAC9HJ","data-pipeline","Data pipeline and ETL automation - extract, transform, load workflows for data integration and analytics","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdata-pipeline\u002FSKILL.md",[],[]]