document-export

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Document Export

文档导出

You can export your responses, research, and analysis to professional documents in five formats: PDF, DOCX, PPTX, CSV, and XLSX.
您可以将回复内容、研究成果和分析结果导出为五种格式的专业文档:PDF、DOCX、PPTX、CSV和XLSX。

Tools

工具

document_export

document_export

Generate a document from structured content. Accepts a format, structured content with sections, and optional configuration.
Formats:
pdf
,
docx
,
pptx
,
csv
,
xlsx
Content structure:
  • title
    (required) -- document title for cover pages and metadata
  • subtitle
    -- shown below the title on cover pages
  • author
    -- embedded in document metadata
  • date
    -- ISO 8601 date string
  • theme
    -- visual preset:
    dark
    ,
    light
    ,
    corporate
    ,
    creative
    ,
    minimal
  • sections[]
    -- ordered content sections, each containing any combination of:
    • heading
      +
      level
      (1/2/3)
    • paragraphs[]
      -- body text with inline markdown (
      **bold**
      ,
      *italic*
      ,
      [link](url)
      )
    • table
      --
      { headers: string[], rows: string[][] }
    • chart
      --
      { type: bar|line|pie|doughnut|area|scatter, data: [...], title? }
    • list
      --
      { items: string[], ordered?: boolean }
    • keyValues
      --
      [{ key, value }]
      rendered as definition tables
    • image
      --
      { url?, base64?, caption?, width? }
    • speakerNotes
      -- PPTX only, attached as slide notes
    • layout
      -- PPTX hint:
      title
      ,
      content
      ,
      two-column
      ,
      image-left
      ,
      image-right
      ,
      chart-full
      ,
      comparison
Options:
filename
,
pageSize
(letter/a4/legal),
orientation
(portrait/landscape),
coverPage
,
pageNumbers
Output:
{ filePath, downloadUrl, previewUrl, format, sizeBytes, filename }
从结构化内容生成文档。支持指定格式、带章节的结构化内容以及可选配置。
格式
pdf
,
docx
,
pptx
,
csv
,
xlsx
内容结构:
  • title
    (必填)-- 用于封面和元数据的文档标题
  • subtitle
    -- 显示在封面标题下方
  • author
    -- 嵌入文档元数据
  • date
    -- ISO 8601格式日期字符串
  • theme
    -- 视觉预设:
    dark
    ,
    light
    ,
    corporate
    ,
    creative
    ,
    minimal
  • sections[]
    -- 有序的内容章节,每个章节可包含以下任意组合:
    • heading
      +
      level
      (1/2/3)
    • paragraphs[]
      -- 支持内联Markdown格式的正文文本(
      **加粗**
      *斜体*
      [链接](url)
    • table
      --
      { headers: string[], rows: string[][] }
    • chart
      --
      { type: bar|line|pie|doughnut|area|scatter, data: [...], title? }
    • list
      --
      { items: string[], ordered?: boolean }
    • keyValues
      --
      [{ key, value }]
      渲染为定义表格
    • image
      --
      { url?, base64?, caption?, width? }
    • speakerNotes
      -- 仅PPTX支持,作为幻灯片备注附加
    • layout
      -- PPTX布局提示:
      title
      ,
      content
      ,
      two-column
      ,
      image-left
      ,
      image-right
      ,
      chart-full
      ,
      comparison
选项
filename
,
pageSize
(letter/a4/legal),
orientation
(portrait/landscape),
coverPage
,
pageNumbers
输出
{ filePath, downloadUrl, previewUrl, format, sizeBytes, filename }

document_suggest

document_suggest

Check whether a response should offer document export. Pure heuristic, no LLM call.
Input:
responseText
,
wordCount
,
hasTableData
,
hasSections
,
isAnalytical
Rules:
  • 500+ words -> suggest PDF, DOCX
  • Tabular data -> suggest CSV, XLSX
  • Distinct sections -> suggest PPTX
  • Analytical/quantitative -> reinforce PDF, XLSX
  • Minimum 200 words before any suggestion
Output:
{ shouldOffer, suggestedFormats[], offerText }
判断是否应向用户提供文档导出功能。基于纯启发式规则,无需调用大语言模型。
输入
responseText
,
wordCount
,
hasTableData
,
hasSections
,
isAnalytical
规则:
  • 字数≥500 -> 推荐PDF、DOCX
  • 包含表格数据 -> 推荐CSV、XLSX
  • 包含独立章节 -> 推荐PPTX
  • 分析类/量化内容 -> 优先推荐PDF、XLSX
  • 字数≥200才会触发推荐
输出
{ shouldOffer, suggestedFormats[], offerText }

When to Offer Export

何时提供导出功能

After generating substantive responses, use
document_suggest
to check if you should offer export:
  • Long responses (500+ words) -> offer PDF or DOCX
  • Data-heavy responses with tables -> offer CSV or XLSX
  • Multi-section analysis -> offer PPTX slide deck
  • Short conversational responses -> don't offer
生成实质性回复后,使用
document_suggest
判断是否应提供导出:
  • 长回复(500字以上)-> 提供PDF或DOCX
  • 包含大量表格的数据类回复 -> 提供CSV或XLSX
  • 多章节分析内容 -> 提供PPTX幻灯片
  • 简短对话式回复 -> 不提供

How to Export

导出步骤

When the user requests an export (or accepts your offer):
  1. Structure your response content into DocumentContent format
  2. Choose the right format based on what the user asked for
  3. Call
    document_export
    with the structured content
  4. Share the download link with the user
当用户请求导出(或接受您的推荐)时:
  1. 将回复内容整理为DocumentContent格式
  2. 根据用户需求选择合适的格式
  3. 调用
    document_export
    并传入结构化内容
  4. 向用户分享下载链接

Format Guide

格式指南

PDF Reports

PDF报告

Best for long-form research, analysis, and formal reports.
  • Use level-1 heading for title, level-2 for major sections, level-3 for subsections
  • Include tables for comparative data
  • Add charts where numeric data is present (bar for comparisons, line for trends, pie for composition)
  • Cover page generated automatically with title, subtitle, author, date
  • Page numbers and headers included by default
  • Supports inline markdown: bold, italic, links
  • Images embedded from URLs or base64
最适合长篇研究、分析内容和正式报告。
  • 使用一级标题作为文档标题,二级标题作为主要章节,三级标题作为子章节
  • 用表格呈现对比数据
  • 有数值数据时添加图表(柱状图用于对比,折线图用于趋势,饼图用于占比)
  • 自动生成包含标题、副标题、作者、日期的封面
  • 默认包含页码和页眉
  • 支持内联Markdown格式:加粗斜体链接
  • 支持从URL或base64嵌入图片

DOCX Word Documents

DOCX Word文档

Same content capabilities as PDF but editable.
  • Users who say "I need to edit it" or "send me a Word doc" -> DOCX
  • All section types supported: headings, paragraphs, tables, charts (as data tables), images, lists
  • Inline formatting preserved: bold, italic, hyperlinks
  • Cover page, headers, footers with page numbers
具备PDF的所有内容能力,但支持编辑。
  • 用户提及“我需要编辑”或“发我Word文档”时,选择DOCX
  • 支持所有章节类型:标题、段落、表格、图表(以数据表形式)、图片、列表
  • 保留内联格式:加粗、斜体、超链接
  • 包含封面、页眉、页脚及页码

PPTX Slide Decks

PPTX幻灯片

Each section maps to one slide. Best for presentations and visual summaries.
  • Keep text concise on slides -- move detail to
    speakerNotes
  • Use
    layout
    hints:
    title
    for opener,
    content
    for standard,
    chart-full
    for data slides
  • Native chart rendering (bar, line, pie, doughnut, area, scatter via pptxgenjs)
  • Images automatically fetched and embedded
  • Slide numbers in bottom-right
Themes:
  • corporate
    -- business presentations, quarterly reviews (navy/grey, Arial)
  • dark
    -- conference talks, tech demos (navy background, cyan accent)
  • light
    -- general purpose, academic (white background, blue accent) [default]
  • creative
    -- marketing, workshops (warm amber, gold accent, Georgia titles)
  • minimal
    -- data-focused, research (monochrome, generous whitespace)
每个章节对应一张幻灯片。最适合演示和可视化摘要。
  • 幻灯片文字保持简洁,详细内容移至
    speakerNotes
  • 使用布局提示:
    title
    用于开场页,
    content
    用于标准页,
    chart-full
    用于数据页
  • 原生支持图表渲染(通过pptxgenjs实现柱状图、折线图、饼图、环形图、面积图、散点图)
  • 自动获取并嵌入图片
  • 右下角显示幻灯片编号
主题:
  • corporate
    -- 商务演示、季度复盘(深蓝/灰色,Arial字体)
  • dark
    -- 会议演讲、技术演示(深蓝背景,青色强调色)
  • light
    -- 通用场景、学术用途(白色背景,蓝色强调色)【默认】
  • creative
    -- 营销推广、工作坊(暖琥珀色,金色强调色,Georgia标题字体)
  • minimal
    -- 数据导向、研究场景(黑白配色,充足留白)

CSV

CSV

Tabular data only. Each table section becomes a block of rows; multiple tables separated by blank rows.
  • Best for data exports the user wants to import elsewhere
  • Key-value pairs rendered as two-column tables
  • Throws an error if no tabular data found (suggest PDF/DOCX instead)
仅支持表格数据。每个表格章节对应一组行数据;多个表格之间用空行分隔。
  • 最适合用户需要导入至其他系统的数据导出
  • 键值对将渲染为两列表格
  • 若未检测到表格数据则抛出错误(建议改用PDF/DOCX)

XLSX Spreadsheets

XLSX电子表格

Multi-sheet Excel workbooks with formatting.
  • Each table section becomes its own worksheet
  • Header rows styled with accent colour and white bold text
  • Auto-detected numeric columns get number formatting and SUM formulas
  • Frozen header row for easy scrolling
  • Auto-sized column widths
带格式的多工作表Excel工作簿。
  • 每个表格章节对应一个独立工作表
  • 表头行使用强调色和白色加粗文字样式
  • 自动识别数值列并添加数字格式和SUM公式
  • 冻结表头行以便滚动查看
  • 自动调整列宽

Example Workflows

示例流程

Research -> PDF Report

研究内容 -> PDF报告

  1. User asks a research question
  2. You conduct deep research, compile findings
  3. document_suggest
    detects long analytical response ->
    shouldOffer: true
  4. You offer: "I can export this analysis as a PDF or Word document. Want me to?"
  5. User says "PDF please"
  6. You call
    document_export
    with
    format: "pdf"
    , structured sections, charts for data
  7. Share the download link
  1. 用户提出研究问题
  2. 您开展深度研究,整理成果
  3. document_suggest
    检测到长篇分析回复 ->
    shouldOffer: true
  4. 您询问:“我可以将这份分析导出为PDF或Word文档,需要我操作吗?”
  5. 用户回复“请导出PDF”
  6. 您调用
    document_export
    ,传入
    format: "pdf"
    、结构化章节和数据图表
  7. 分享下载链接

Data Analysis -> Spreadsheet

数据分析 -> 电子表格

  1. User provides data or asks for analysis
  2. You analyze, produce tables and charts
  3. document_suggest
    detects tabular data -> suggests CSV, XLSX
  4. User requests XLSX
  5. You call
    document_export
    with tables as sections
  6. Each table becomes a formatted worksheet with SUM formulas
  1. 用户提供数据或请求分析
  2. 您完成分析,生成表格和图表
  3. document_suggest
    检测到表格数据 -> 推荐CSV、XLSX
  4. 用户请求XLSX
  5. 您调用
    document_export
    并传入表格作为章节
  6. 每个表格将成为带SUM公式的格式化工作表

Presentation -> PPTX

演示内容 -> PPTX

  1. User asks you to prepare a presentation
  2. You organize content into distinct sections (intro, body, conclusion)
  3. Use
    layout: "title"
    for opener,
    "content"
    for body,
    "chart-full"
    for data
  4. Set
    theme: "corporate"
    for business contexts
  5. Add
    speakerNotes
    with talking points
  6. Call
    document_export
    with
    format: "pptx"
  1. 用户请求准备演示文稿
  2. 您将内容整理为独立章节(引言、正文、结论)
  3. 对开场页使用
    layout: "title"
    ,正文页使用
    "content"
    ,数据页使用
    "chart-full"
  4. 商务场景下设置
    theme: "corporate"
  5. 添加包含演讲要点的
    speakerNotes
  6. 调用
    document_export
    并传入
    format: "pptx"

Multi-Format

多格式选择

If the user says "export this" without specifying format, offer the most relevant options:
  • Research/analysis -> PDF + DOCX
  • Data-heavy -> XLSX + CSV
  • Structured overview -> PPTX
  • General long content -> PDF (most universally useful)
若用户仅说“导出这个”未指定格式,推荐最相关的选项:
  • 研究/分析内容 -> PDF + DOCX
  • 数据密集型内容 -> XLSX + CSV
  • 结构化概述内容 -> PPTX
  • 通用长篇内容 -> PDF(最具通用性)