mcpField
O
office

office

github.com/jezwebドキュメント1.1k422 回インストール3 週間前に更新
リポジトリ

office について

TypeScriptでオフィス文書をプログラム生成する開発者向けガイドです。DOCX、XLSX、PDF、PPTX 用の JavaScript ライブラリを紹介し、ブラウザー、Node.js、Workers での出力方法と注意点を説明します。

主な機能

  1. 01DOCX 文書と表の生成
  2. 02XLSX ブックとワークシートの作成
  3. 03PDF の作成、編集、結合
  4. 04チャートや画像を含む PPTX の作成
  5. 05ブラウザー、Node.js、Workers 向けの出力パターン
  6. 06形式ごとの問題の調査

活用シーン

  1. 01アプリケーションのデータから Word レポートを生成
  2. 02レコードを Excel ブックにエクスポート
  3. 03フォームへの入力や PDF ファイルの結合
  4. 04API で文書を生成しダウンロードとして返却

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/jezweb/claude-skills --skill office

インストール後、Claude Code で/officeを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

README.md
.claude-plugin/
plugin.json
agents/
office-docs.md
references/
docx-api.md
pdf-lib-api.md
pptxgenjs-api.md
xlsx-api.md
rules/
office.md
scripts/
verify-deps.sh
templates/
docx-basic.ts
pdf-basic.ts
pptx-basic.ts
workers-pdf.ts
xlsx-basic.ts

詳細

Office ドキュメントの生成

ステータス: 本番環境で使用可能 最終更新日: 2026-01-12 依存関係: なし(純粋な JavaScript ライブラリ) 最新バージョン: [email protected], [email protected], [email protected], [email protected]


概要

TypeScript で Microsoft Office ドキュメントと PDF をプログラムによって生成できます。すべてのライブラリは純粋な JavaScript で、ネイティブの依存関係がないため、あらゆるランタイム環境で使用できます。

形式ライブラリWorkersブラウザーNode.js
DOCXdocx✅✅✅
XLSXxlsx (SheetJS)✅✅✅
PDFpdf-lib✅✅✅
PPTXpptxgenjs⚠️*✅✅

*Workers での PPTX:ローカルの画像/データで動作します。リモート画像の取得には回避策が必要です(https モジュールを使用します)。


クイックスタート

インストール
# Install all four (or pick what you need)
npm install docx xlsx pdf-lib pptxgenjs
Word ドキュメントを作成する(30 秒)
import { Document, Packer, Paragraph, TextRun } from 'docx';
import { writeFileSync } from 'fs';

const doc = new Document({
  sections: [{
    children: [
      new Paragraph({
        children: [
          new TextRun({ text: 'Hello World', bold: true, size: 48 }),
        ],
      }),
    ],
  }],
});

// Node.js: Save to file
const buffer = await Packer.toBuffer(doc);
writeFileSync('hello.docx', buffer);

// Browser/Workers: Get as blob
const blob = await Packer.toBlob(doc);
Excel スプレッドシートを作成する(30 秒)
import * as XLSX from 'xlsx';

// Create workbook with data
const data = [
  ['Name', 'Amount', 'Date'],
  ['Invoice #1', 1500, '2026-01-12'],
  ['Invoice #2', 2300, '2026-01-13'],
];

const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Invoices');

// Node.js: Save to file
XLSX.writeFile(workbook, 'invoices.xlsx');

// Browser/Workers: Get as buffer
const buffer = XLSX.write(workbook, { type: 'buffer', bookType: 'xlsx' });
PDF を作成する(30 秒)
import { PDFDocument, StandardFonts, rgb } from 'pdf-lib';

const pdfDoc = await PDFDocument.create();
const page = pdfDoc.addPage([612, 792]); // Letter size
const font = await pdfDoc.embedFont(StandardFonts.Helvetica);

page.drawText('Hello World', {
  x: 50,
  y: 700,
  size: 24,
  font,
  color: rgb(0, 0, 0),
});

// Get as bytes (works everywhere)
const pdfBytes = await pdfDoc.save();

// Node.js: Save to file
writeFileSync('hello.pdf', pdfBytes);
PowerPoint を作成する(30 秒)
import pptxgen from 'pptxgenjs';

const pptx = new pptxgen();
pptx.author = 'Your Name';
pptx.title = 'Sample Presentation';

// Add a slide
const slide = pptx.addSlide();
slide.addText('Hello World', {
  x: 1, y: 1, w: 8, h: 1.5,
  fontSize: 36, bold: true, color: '363636',
});

// Node.js: Save to file
await pptx.writeFile({ fileName: 'hello.pptx' });

// Browser: Trigger download
await pptx.writeFile({ fileName: 'hello.pptx' });

DOCX:Word ドキュメント

主な概念

docx パッケージではビルダーパターンを使用します。

  • Document - ルートコンテナー
  • Section - ページを含みます(ほとんどのドキュメントは 1 つのセクションで構成されます)
  • Paragraph - テキストの行/ブロック
  • TextRun - 段落内の書式付きテキスト
  • Table - TableRow → TableCell → Paragraph で構成されるグリッド
見出しと段落を含むドキュメント
import { Document, Packer, Paragraph, TextRun, HeadingLevel } from 'docx';

const doc = new Document({
  sections: [{
    children: [
      new Paragraph({
        text: 'Monthly Report',
        heading: HeadingLevel.HEADING_1,
      }),
      new Paragraph({
        children: [
          new TextRun('This is a '),
          new TextRun({ text: 'bold', bold: true }),
          new TextRun(' and '),
          new TextRun({ text: 'italic', italics: true }),
          new TextRun(' text example.'),
        ],
      }),
    ],
  }],
});
表
import { Document, Table, TableRow, TableCell, Paragraph, WidthType } from 'docx';

const table = new Table({
  width: { size: 100, type: WidthType.PERCENTAGE },
  rows: [
    new TableRow({
      children: [
        new TableCell({ children: [new Paragraph('Header 1')] }),
        new TableCell({ children: [new Paragraph('Header 2')] }),
      ],
    }),
    new TableRow({
      children: [
        new TableCell({ children: [new Paragraph('Data 1')] }),
        new TableCell({ children: [new Paragraph('Data 2')] }),
      ],
    }),
  ],
});

const doc = new Document({
  sections: [{ children: [table] }],
});
画像
import { Document, Paragraph, ImageRun } from 'docx';
import { readFileSync } from 'fs';

const imageBuffer = readFileSync('logo.png');

const doc = new Document({
  sections: [{
    children: [
      new Paragraph({
        children: [
          new ImageRun({
            data: imageBuffer,
            transformation: { width: 200, height: 100 },
            type: 'png',
          }),
        ],
      }),
    ],
  }],
});
エクスポートパターン
// Node.js - Save to file
import { writeFileSync } from 'fs';
const buffer = await Packer.toBuffer(doc);
writeFileSync('document.docx', buffer);

// Browser - Download
const blob = await Packer.toBlob(doc);
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'document.docx';
a.click();

// Cloudflare Workers - Return as Response
const buffer = await Packer.toBuffer(doc);
return new Response(buffer, {
  headers: {
    'Content-Type': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
    'Content-Disposition': 'attachment; filename="document.docx"',
  },
});

XLSX:Excel スプレッドシート

主な概念

SheetJS(xlsx)ではユーティリティ関数を使用します。

  • Workbook - シートのコンテナー
  • Worksheet - 単一のシート(セルのグリッド)
  • utils.aoa_to_sheet - 配列の配列 → ワークシート
  • utils.json_to_sheet - JSON 配列 → ワークシート
  • utils.book_new/book_append_sheet - シートを作成/追加
配列の配列から作成
import * as XLSX from 'xlsx';

const data = [
  ['Product', 'Price', 'Quantity', 'Total'],
  ['Widget A', 10, 5, { f: 'B2*C2' }],  // Formula
  ['Widget B', 15, 3, { f: 'B3*C3' }],
  ['', '', 'Grand Total:', { f: 'SUM(D2:D3)' }],
];

const ws = XLSX.utils.aoa_to_sheet(data);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sales');
JSON から作成
const invoices = [
  { id: 1, customer: 'Acme Corp', amount: 1500, date: '2026-01-12' },
  { id: 2, customer: 'Globex', amount: 2300, date: '2026-01-13' },
];

const ws = XLSX.utils.json_to_sheet(invoices);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Invoices');
列幅
// Set column widths (in characters)
ws['!cols'] = [
  { wch: 10 },  // Column A
  { wch: 20 },  // Column B
  { wch: 15 },  // Column C
];
複数のシート
const wb = XLSX.utils.book_new();

const summaryData = [['Total Sales', 3800]];
const detailData = [['Item', 'Amount'], ['Item 1', 1500], ['Item 2', 2300]];

XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(summaryData), 'Summary');
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(detailData), 'Details');
エクスポートパターン
// Node.js - Save to file
XLSX.writeFile(workbook, 'report.xlsx');

// Browser/Workers - Get buffer
const buffer = XLSX.write(workbook, { type: 'buffer', bookType: 'xlsx' });

// Cloudflare Workers - Return as Response
return new Response(buffer, {
  headers: {
    'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    'Content-Disposition': 'attachment; filename="report.xlsx"',
  },
});

PDF:PDF ドキュメント

主な概念

pdf-lib ではページベースの方式を使用します。

  • PDFDocument - PDF ファイル
  • PDFPage - 個々のページ
  • 座標 - 原点は左下(左上ではありません!)
  • 単位 - ポイント(72 ポイント = 1 インチ)
標準ページサイズ
// Common sizes in points [width, height]
const LETTER = [612, 792];    // 8.5" x 11"
const A4 = [595.28, 841.89];  // 210mm x 297mm
const LEGAL = [612, 1008];    // 8.5" x 14"
テキストとフォント
import { PDFDocument, StandardFonts, rgb } from 'pdf-lib';

const pdfDoc = await PDFDocument.create();
const page = pdfDoc.addPage([612, 792]);

// Embed standard fonts
const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica);
const helveticaBold = await pdfDoc.embedFont(StandardFonts.HelveticaBold);

// Draw text (y=0 is BOTTOM of page)
page.drawText('Invoice #12345', {
  x: 50,
  y: 750,  // Near top of page
  size: 24,
  font: helveticaBold,
  color: rgb(0, 0, 0),
});

page.drawText('Thank you for your business!', {
  x: 50,
  y: 50,  // Near bottom of page
  size: 12,
  font: helvetica,
  color: rgb(0.5, 0.5, 0.5),
});
図形の描画
// Rectangle
page.drawRectangle({
  x: 50,
  y: 600,
  width: 200,
  height: 100,
  borderColor: rgb(0, 0, 0),
  borderWidth: 1,
  color: rgb(0.95, 0.95, 0.95),  // Fill color
});

// Line
page.drawLine({
  start: { x: 50, y: 500 },
  end: { x: 550, y: 500 },
  thickness: 1,
  color: rgb(0, 0, 0),
});
画像
// From URL/fetch
const imageBytes = await fetch('https://example.com/logo.png').then(r => r.arrayBuffer());
const image = await pdfDoc.embedPng(imageBytes);

// Or embedJpg for JPEG
// const image = await pdfDoc.embedJpg(imageBytes);

page.drawImage(image, {
  x: 50,
  y: 700,
  width: 100,
  height: 50,
});
PDF フォームへの入力
import { PDFDocument } from 'pdf-lib';

// Load existing PDF with form
const existingPdfBytes = await fetch('form.pdf').then(r => r.arrayBuffer());
const pdfDoc = await PDFDocument.load(existingPdfBytes);

// Get form and fields
const form = pdfDoc.getForm();
const nameField = form.getTextField('customer_name');
const dateField = form.getTextField('date');

// Fill fields
nameField.setText('John Doe');
dateField.setText('2026-01-12');

// Flatten form (make fields non-editable)
form.flatten();

const pdfBytes = await pdfDoc.save();
PDF の結合
import { PDFDocument } from 'pdf-lib';

const pdf1Bytes = await fetch('doc1.pdf').then(r => r.arrayBuffer());
const pdf2Bytes = await fetch('doc2.pdf').then(r => r.arrayBuffer());

const mergedPdf = await PDFDocument.create();
const pdf1 = await PDFDocument.load(pdf1Bytes);
const pdf2 = await PDFDocument.load(pdf2Bytes);

// Copy all pages from both documents
const pages1 = await mergedPdf.copyPages(pdf1, pdf1.getPageIndices());
const pages2 = await mergedPdf.copyPages(pdf2, pdf2.getPageIndices());

pages1.forEach(page => mergedPdf.addPage(page));
pages2.forEach(page => mergedPdf.addPage(page));

const mergedBytes = await mergedPdf.save();

PPTX:PowerPoint プレゼンテーション

主な概念

pptxgenjs ではスライドベースの方式を使用します。

  • Presentation - PPTX ファイル(new pptxgen())
  • Slide - 個々のスライド(addSlide())
  • 要素 - テキスト、画像、図形、表、グラフ
  • 単位 - デフォルトはインチ(cm/ポイントに変更できます)
基本的なプレゼンテーション
import pptxgen from 'pptxgenjs';

const pptx = new pptxgen();
pptx.author = 'Author Name';
pptx.title = 'Presentation Title';
pptx.subject = 'Subject';
pptx.company = 'Company';

// Title slide
const titleSlide = pptx.addSlide();
titleSlide.addText('Quarterly Report', {
  x: 0.5, y: 2, w: 9, h: 1,
  fontSize: 44, bold: true, color: '0066CC', align: 'center',
});
titleSlide.addText('Q1 2026', {
  x: 0.5, y: 3.5, w: 9, h: 0.5,
  fontSize: 24, color: '666666', align: 'center',
});
箇条書きを含むスライド
const contentSlide = pptx.addSlide();

// Title
contentSlide.addText('Key Highlights', {
  x: 0.5, y: 0.5, w: 9, h: 0.8,
  fontSize: 32, bold: true, color: '333333',
});

// Bullet points
contentSlide.addText([
  { text: 'Revenue up 25% YoY', options: { bullet: true, fontSize: 20 } },
  { text: 'Customer base grew to 10,000', options: { bullet: true, fontSize: 20 } },
  { text: 'New product launch successful', options: { bullet: true, fontSize: 20 } },
  { text: 'Expanded to 5 new markets', options: { bullet: true, fontSize: 20 } },
], { x: 0.5, y: 1.5, w: 8, h: 4, valign: 'top' });
表
const tableSlide = pptx.addSlide();

tableSlide.addText('Sales Summary', {
  x: 0.5, y: 0.5, w: 9, h: 0.8,
  fontSize: 28, bold: true,
});

const tableData = [
  [{ text: 'Region', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },
   { text: 'Q1', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },
   { text: 'Q2', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } }],
  ['North America', '$2.5M', '$2.8M'],
  ['Europe', '$1.8M', '$2.1M'],
  ['Asia Pacific', '$1.2M', '$1.5M'],
];

tableSlide.addTable(tableData, {
  x: 0.5, y: 1.5, w: 9,
  border: { pt: 1, color: 'CCCCCC' },
  fontFace: 'Arial',
  fontSize: 14,
  align: 'center',
  valign: 'middle',
});
グラフ
const chartSlide = pptx.addSlide();

chartSlide.addText('Revenue Trend', {
  x: 0.5, y: 0.5, w: 9, h: 0.6,
  fontSize: 28, bold: true,
});

chartSlide.addChart(pptx.ChartType.line, [
  { name: 'Revenue', labels: ['Jan', 'Feb', 'Mar', 'Apr'], values: [100, 120, 150, 180] },
  { name: 'Expenses', labels: ['Jan', 'Feb', 'Mar', 'Apr'], values: [80, 85, 90, 95] },
], {
  x: 0.5, y: 1.2, w: 9, h: 4,
  showLegend: true,
  legendPos: 'b',
  showTitle: false,
});
画像
import { readFileSync } from 'fs';

const imageSlide = pptx.addSlide();

// From file (Node.js)
imageSlide.addImage({
  path: 'logo.png',
  x: 0.5, y: 0.5, w: 2, h: 1,
});

// From base64
const imageBase64 = readFileSync('chart.png').toString('base64');
imageSlide.addImage({
  data: `image/png;base64,${imageBase64}`,
  x: 0.5, y: 2, w: 4, h: 3,
});

// From URL (Node.js only - uses https module)
imageSlide.addImage({
  path: 'https://example.com/image.png',
  x: 5, y: 2, w: 4, h: 3,
});
図形
const shapeSlide = pptx.addSlide();

// Rectangle
shapeSlide.addShape(pptx.ShapeType.rect, {
  x: 0.5, y: 0.5, w: 3, h: 2,
  fill: { color: '0066CC' },
  line: { color: '004499', pt: 2 },
});

// Circle/Oval
shapeSlide.addShape(pptx.ShapeType.ellipse, {
  x: 4, y: 0.5, w: 2, h: 2,
  fill: { color: '00AA00' },
});

// Arrow
shapeSlide.addShape(pptx.ShapeType.rightArrow, {
  x: 1, y: 3, w: 3, h: 1,
  fill: { color: 'FF6600' },
});
スライドレイアウトとマスター
// Define a master slide
pptx.defineSlideMaster({
  title: 'COMPANY_MASTER',
  background: { color: 'FFFFFF' },
  objects: [
    { text: { text: 'Company Name', options: { x: 0.5, y: 0.2, w: 4, h: 0.3, fontSize: 10, color: '999999' } } },
    { line: { x: 0.5, y: 0.6, w: 9, h: 0, line: { color: '0066CC', pt: 2 } } },
  ],
});

// Use the master
const slide = pptx.addSlide({ masterName: 'COMPANY_MASTER' });
エクスポートパターン
// Node.js - Save to file
await pptx.writeFile({ fileName: 'presentation.pptx' });

// Browser - Trigger download
await pptx.writeFile({ fileName: 'presentation.pptx' });

// Get as base64 (for email, API, etc.)
const base64 = await pptx.write({ outputType: 'base64' });

// Get as Blob (browser)
const blob = await pptx.write({ outputType: 'blob' });

// Get as ArrayBuffer
const arrayBuffer = await pptx.write({ outputType: 'arraybuffer' });

// Cloudflare Workers - Return as Response
const arrayBuffer = await pptx.write({ outputType: 'arraybuffer' });
return new Response(arrayBuffer, {
  headers: {
    'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
    'Content-Disposition': 'attachment; filename="presentation.pptx"',
  },
});

Cloudflare Workers との統合

4 つすべてのライブラリは Cloudflare Workers で動作します(PPTX はリモート画像に関する制限があります)。

DOCX 生成エンドポイント
import { Hono } from 'hono';
import { Document, Packer, Paragraph, TextRun } from 'docx';

const app = new Hono();

app.get('/api/invoice/:id', async (c) => {
  const invoiceId = c.req.param('id');

  const doc = new Document({
    sections: [{
      children: [
        new Paragraph({
          children: [new TextRun({ text: `Invoice #${invoiceId}`, bold: true, size: 48 })],
        }),
      ],
    }],
  });

  const buffer = await Packer.toBuffer(doc);

  return new Response(buffer, {
    headers: {
      'Content-Type': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
      'Content-Disposition': `attachment; filename="invoice-${invoiceId}.docx"`,
    },
  });
});

export default app;
ブラウザーレンダリングを使った HTML から PDF への変換

CSS を使った複雑なレイアウトには、Cloudflare Browser Rendering(有料機能)を使用します。

import puppeteer from '@cloudflare/puppeteer';

export default {
  async fetch(request, env) {
    const browser = await puppeteer.launch(env.BROWSER);
    const page = await browser.newPage();

    // Set HTML content
    await page.setContent(`
      <html>
        <head>
          <style>
            body { font-family: Arial, sans-serif; padding: 40px; }
            h1 { color: #333; }
            table { width: 100%; border-collapse: collapse; }
            td, th { border: 1px solid #ddd; padding: 8px; }
          </style>
        </head>
        <body>
          <h1>Invoice #12345</h1>
          <table>
            <tr><th>Item</th><th>Amount</th></tr>
            <tr><td>Service</td><td>$500</td></tr>
          </table>
        </body>
      </html>
    `);

    const pdf = await page.pdf({ format: 'A4' });
    await browser.close();

    return new Response(pdf, {
      headers: {
        'Content-Type': 'application/pdf',
        'Content-Disposition': 'attachment; filename="invoice.pdf"',
      },
    });
  },
};

wrangler.jsonc のバインディング:

{
  "browser": {
    "binding": "BROWSER"
  }
}

重要なルール

必ず行うこと

✅ DOCX には await Packer.toBuffer() を使用します(非同期処理です) ✅ PDF の座標は左下から始まることを忘れないでください ✅ Workers/ブラウザーで XLSX を使う場合は type: 'buffer' を使用します ✅ PDF でフォントを使う前に埋め込みます ✅ ダウンロード用に適切な Content-Type ヘッダーを設定します ✅ PPTX には await pptx.writeFile() または await pptx.write() を使用します ✅ Workers で PPTX を使う場合は base64 画像を使用します(リモート URL は避けてください)

決して行わないでください

❌ Packer.toBuffer() を await せずに使用しないでください(Promise を返します) ❌ PDF の y=0 が上端にあると思い込まないでください(下端にあります) ❌ Workers で writeFile を使用しないでください(代わりに Response を使用します) ❌ ダウンロード用の Content-Disposition の設定を忘れないでください ❌ ブラウザーや Workers で Node.js の fs モジュールを使用しないでください ❌ Workers で PPTX のパス URL を使用しないでください(https モジュールは利用できません)


既知の問題の防止

問題 #1:DOCX Packer が Promise を返す

エラー:ファイル内に [object Promise] が表示される、またはドキュメントが空になる 理由:Packer.toBuffer() は非同期ですが、await せずに呼び出されています 防止策:必ず await Packer.toBuffer(doc) を使用してください

問題 #2:PDF のテキストが誤った位置に表示される

エラー:テキストがページ下部またはページ外に表示される 理由:PDF の座標の原点は左上ではなく、左下です 防止策:上部付近にテキストを配置するには、高い y 値を使用してください(レターサイズの場合、y=750 など)

問題 #3:XLSX の数式が計算されない

エラー:セルに計算結果ではなく数式のテキストが表示される 理由:SheetJS は数式を実行せず、Excel がファイルを開くときに実行します 防止策:これは想定どおりです。Excel で開くと数式が計算されます

問題 #4:Workers で DOCX/PDF が空になる

エラー:ダウンロードしたファイルが空、または破損している 理由:返す型が誤っているか、Content-Type ヘッダーがありません 防止策:適切なヘッダーを設定し、バッファーを直接返してください

問題 #5:Workers で PPTX のリモート画像を取得できない

エラー:https is not defined と表示される、または画像が表示されない 理由:pptxgenjs はリモート画像の取得に Node.js の https モジュールを使用します 防止策:Workers 環境では、base64 データ URI またはローカル画像を使用してください


同梱リソースの使用

テンプレート(templates/)
  • docx-basic.ts - 見出し、表、画像を含む完成版 Word ドキュメント
  • xlsx-basic.ts - 数式と書式設定を含む Excel ブック
  • pdf-basic.ts - テキスト、画像、図形を含む PDF
  • pptx-basic.ts - スライド、グラフ、表を含む PowerPoint
  • workers-pdf.ts - Cloudflare Workers での PDF 生成例
リファレンス(references/)
  • docx-api.md - docx npm パッケージのクイックリファレンス
  • xlsx-api.md - SheetJS 関数のクイックリファレンス
  • pdf-lib-api.md - pdf-lib メソッドのクイックリファレンス
  • pptxgenjs-api.md - pptxgenjs のクイックリファレンス
スクリプト(scripts/)
  • verify-deps.sh - ライブラリのバージョンが最新か確認します

Anthropic 公式スキルとの制限事項の比較

このスキルは、ポータブルな TypeScript ライブラリを使用したドキュメント作成に重点を置いています。

機能このスキルAnthropic のスキル
DOCX/XLSX/PDF/PPTX の作成✅✅
Cloudflare Workers で動作✅❌
プラグインとしてインストール可能✅❌
TypeScript を優先✅❌ (Python)
変更履歴を記録しながら既存の DOCX を編集❌✅
Excel の数式を検証❌✅
スキャンした PDF の OCR❌✅

変更履歴や数式の検証など、高度な編集を行う場合は、Python ツールを使用する Anthropic 公式スキルをご検討ください。


パッケージのバージョン(2026-01-12 確認済み)

{
  "dependencies": {
    "docx": "^9.5.0",
    "xlsx": "^0.18.5",
    "pdf-lib": "^1.17.1",
    "pptxgenjs": "^4.0.1"
  }
}

公式ドキュメント


セットアップ完了チェックリスト

  • 必要なパッケージをインストールした(npm install docx xlsx pdf-lib)
  • インポート文が実行環境(Node.js またはブラウザー)に合っていることを確認した
  • 対象環境に適したエクスポート方法を使用した
  • HTTP レスポンスに Content-Type ヘッダーを設定した
  • 対象のアプリケーションでドキュメントが正しく開くことをテストした
  • Workers との互換性を確認した(エッジにデプロイする場合)

コメント