Guides

Documents

Create and edit Word, PDF, PowerPoint, and Excel files from Markdown, with split, merge, and OCR tools.

Mobile Agent can create and edit real office documents on the phone. You describe the document in Markdown, and the app builds a styled .docx, .pdf, .pptx, or .xlsx file in the workspace. The same tools can update a document in place, split it, merge it, or scan text out of an image.

Supported formats

FormatExtensionBest for
Word.docxReports, briefs, letters, contracts
PDF.pdfShareable, print-ready documents
PowerPoint.pptxSlide decks and presentations
Excel.xlsxTables, budgets, trackers, data exports
Textany normal extensionMarkdown, code, notes, plain text

Create a document

Ask for the file you want:

text
Create a one-page project brief as a PDF. Include goals, scope, milestones,
and a risk table.

The agent calls createFile with the content and a format of text, docx, pdf, pptx, or xlsx. For text, the name keeps its normal extension. For document formats, the matching extension is added automatically.

Content is Markdown or plain text:

  • Markdown headings become document titles, slides, or sheet sections.
  • Pipe tables become real tables.
  • --- starts a new page or slide.
  • Lists, code blocks, and images are carried into the output.

The tool returns a workspace link that the agent embeds in its reply, so the document opens directly from the chat.

Styling with a format spec

Each format accepts a YAML frontmatter block at the top of the content. The same object can also be passed as a spec parameter, which is merged on top of the frontmatter and persisted with the document so later updates keep the look.

md
---
format:
  fonts:
    body: { family: Georgia, sizePt: 12, color: '#111111' }
  header: { text: 'Quarterly Report' }
  footer: { text: 'Page {PAGE}' }
  includeToc: true
---
 
# Quarterly Report
 
...

What each format supports:

  • docx — page size, orientation, margins, fonts, colors, alignment, spacing, per-level heading styles, code and table styles, headers/footers with page numbers, a table of contents, and images via ![alt](workspace-path-or-data-uri).
  • xlsx — sheet options such as freezeHeaderRow, freezeColumns, autoFilter, tabColor, orientation, paper size, and merges; header/body cell styles (fonts, fills, borders, alignment, number formats such as #,##0.00 or 0%); alternating row stripes; per-column widths and overrides.
  • pptx — presentation layout (16:9, 16:10, 4:3, wide, or custom), theme fonts, background color, a cover slide, title/body box fonts, colors, positions (xIn, yIn, wIn, hIn), bulleting, code and table styles, footer text, and slide numbers.
  • pdf — page size, orientation, margins, body/heading/code/table fonts and colors, paragraph spacing and alignment, per-level heading styles, list indents, table header/border colors, header/footer text with {PAGE}, and page-number position. PDFs use standard PDF fonts, approximating families.

If a style is unknown, the builder falls back to sensible defaults rather than failing.

Update a document

updateDocument edits an existing docx, PDF, pptx, or xlsx file in place, keeping its file name and format. There are two modes:

Whole document

Pass new Markdown or text and the stored source is replaced:

text
Update report.docx: change the milestones section to reflect the new launch date.

Section

For a large document, the agent first reads the document to get its section list, then passes a 0-based section index and content that starts with a Markdown heading. sectionMode controls the edit:

ModeEffect
replaceRewrite the section body.
insertBeforeInsert a new section before it.
insertAfterInsert a new section after it.
appendAdd a new section at the end.
deleteRemove the section.

The stored source keeps its YAML format spec, so styling survives updates. Pass a new spec to restyle the document.

Split and merge

ToolFormatsRanges
splitDocumentdocx, pptx, xlsxSections, slides, or sheets
mergeDocumentsdocx, pptx, xlsxSame-format files, 2–20
splitPdfPDFPage ranges, 1-based
mergePdfsPDF2–20 PDFs, in order
  • splitDocument takes ranges as 0-based indices — "0-2,4", a single "3", open-ended "2-" or "-3", "each", or "all". Documents with a stored source split by heading section; imported pptx/xlsx files without a stored source split losslessly by slide or sheet.
  • splitPdf takes 1-based page ranges such as "1-3,5,7-9".
  • mergeDocuments concatenates same-format files in the order given and keeps the first file's styling.
  • mergePdfs merges PDFs in the order given.

Every split or merge creates new files and leaves the source untouched.

Read, view, and OCR

  • read returns a document's editable Markdown source, or its section list when the document is large.
  • viewFile passes the file to a model that accepts that modality, so it can look at a PDF page, slide, or image directly.
  • ocr runs on-device text recognition on an image (PNG, JPEG, WebP, GIF, BMP, HEIC) and returns the recognized lines. It is read-only and needs a build with the OCR native module.

Imported documents

You can import existing .docx, .xlsx, and .pptx files through the file picker or share sheet. On import, the app captures the document's styling as a spec so later updates keep the original look, and extracts its text so split, merge, and section reads work. Lossless splitting by slide or sheet is available even when no editable source was captured.

Practical notes

  • Document tools work on workspace files. If a file lives in an external folder, import it into the workspace first.
  • Generated documents are normal files: open them in another app, share them, or export them back to an external folder.
  • Very large documents are indexed into sections so the agent can update one part without rewriting the whole file.
  • Formats are built natively on the phone; no Office installation or cloud conversion service is involved.