iOfficeAI / iOfficeAI/OfficeCLI

# Bug: pPrChange snapshot has w:rPr before w:pStyle, violating CT_PPr element order

Open
#277 1 comment 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

## Describe the bug

When creating a tracked format revision on a Word paragraph via `set --prop revision.type=format`, the generated `w:pPrChange` snapshot has `w:rPr` **before** `w:pStyle` inside the inner `w:pPr`, which violates the CT_PPr element order (pStyle first, rPr near-last). `officecli validate` then reports a schema error on the document.

## To reproduce

OfficeCLI v1.0.143, Windows x64:

```
officecli create t.docx
officecli add t.docx /body --type paragraph --prop text="Hello"
officecli set t.docx "/body/p[1]" --prop style=31 --prop revision.type=format --prop revision.author=T
officecli validate t.docx
```

Generated XML:

```xml

```

## Expected

`w:pPr` children in schema order (`` first, `` last); validate passes.

## Actual

Schema error: "The element has invalid child element 'rPr'. List of possible elements expected: ."

## Notes

Manually reordering to `` fixes this schema error (see companion issue: validate false-positive on pPrChange with rPr).

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the listed OfficeCLI commands and inspect the code that generates the w:pPrChange snapshot. Compare the inner w:pPr child order with the expected pStyle-before-rPr XML, then run officecli validate on the reproduced document; done means validation passes without the schema error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.