iOfficeAI / iOfficeAI/OfficeCLI

docx: indent is written as `w:ind w:start=` (ISO strict) and a later save round-trip can drop the left indent

Open
#367 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
30.7k
Forks
2.1k
Avg merge
9d 8h
Merged PRs (30d)
5

Description

### Summary

`set --prop indent=36pt --prop hangingIndent=21pt` writes the paragraph indent as

```xml

```

i.e. the ISO/Strict attribute names, while the rest of the document (Google Docs / Word transitional) uses `w:left` / `w:right`. Word accepts `w:start`, but in one session a subsequent officecli save round-trip lost the value:

- 13 list paragraphs went from `` to ``
- 9 heading paragraphs lost their `` element entirely
- 21 body paragraphs whose indent had been written as `w:left` were unaffected

Re-running `set --prop indent=...` afterwards wrote `w:left` and the value survived later saves. So the loss seems tied to reading back `w:start`, but I could not isolate the exact operation that dropped it (the intervening operations were `raw-set` on `/styles` and `/document`, `add --type toc`, and `close`). Reporting what I observed rather than a minimized repro.

### Environment

- officecli 1.0.147 (aarch64-darwin, nix build via numtide/llm-agents.nix)
- Input: .docx exported from Google Docs, later saved by Word for Mac

### Observed sequence

```bash
officecli open doc.docx
officecli set doc.docx "/body/p[@paraId=00000016]" --prop indent=36pt --prop hangingIndent=21pt
officecli close doc.docx
unzip -p doc.docx word/document.xml | grep -o '' | sort | uniq -c
# 13 <- start/end, not left/right

# ... raw-set on /styles and /document, add --type toc, close ...

unzip -p doc.docx word/document.xml | grep -o '' | sort | uniq -c
# 13 <- left indent gone
```

### Expected

- Write `w:left` / `w:right` (transitional names) to match the rest of the document, and
- never drop an existing `w:start` / `w:left` on read → write round-trip.

Contributor guide

Open the contributing guide

Research direction

Reproduce the documented officecli open/set/close sequence, then inspect word/document.xml with the shown unzip and grep commands before and after the raw-set and TOC operations. Trace how w:start and w:left are read and written; done means preserving existing indent values through round-trips and using the expected transitional attribute names.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.