Skip to content

Editor: add paragraph-level editing support #5

@tmustier

Description

@tmustier

Problem

pptx edit only supports single-paragraph editing. Multi-paragraph text (separate lines with different formatting) cannot be created or preserved.

Current behavior

# Runs array → merged into single paragraph
pptx edit file.pptx 2 16 '[{"text": "line1"}, {"text": "line2"}]'
# Result: "line1line2" on one line

# Paragraphs format → clears text
pptx edit file.pptx 2 16 '{"paragraphs": [[{"text": "line1"}], [{"text": "line2"}]]}'
# Result: empty text

Expected behavior

pptx edit file.pptx 2 16 '{"paragraphs": [[{"text": "line1"}], [{"text": "line2", "bold": true}]]}'
# Result: two lines, second one bold

Root cause

_normalize_content() in editor.py only handles run-level content. The {"paragraphs": ...} format is not recognized and falls through to empty result.

Workaround

Use soft line break (\n which becomes \x0b) for multi-line text within a single paragraph:

pptx edit file.pptx 2 16 $'line1\nline2'

This works but all lines share the same formatting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions