w:rPrChange (Previous Run Properties)
Records the previous run formatting properties before a tracked change, enabling revision tracking at the character formatting level.
Description
w:rPrChange is a revision tracking element that stores the previous (pre-change) run properties when run formatting has been changed and revision tracking is enabled. It is the character-formatting counterpart of w:ins/w:del for content changes.
It is defined in ECMA-376 Part 1 §17.13.5.30.
The child w:rPr inside w:rPrChange holds the run properties before the formatting change. The current properties are in the parent w:rPr.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:id |
xsd:integer |
Positive integer, unique in the document | Revision identifier. |
w:author |
xsd:string |
Any string | Name of the author who changed the formatting. |
w:date |
xsd:dateTime |
ISO 8601 date-time string | Date and time of the change. |
Examples
<!--
The run is now bold (current rPr: b).
It was previously not bold (old rPr inside rPrChange: no b).
-->
<w:r>
<w:rPr>
<w:b/>
<w:rPrChange w:id="2" w:author="Bob" w:date="2024-02-01T09:00:00Z">
<w:rPr/>
</w:rPrChange>
</w:rPr>
<w:t>Bold text with tracked formatting change</w:t>
</w:r>
using DocumentFormat.OpenXml.Wordprocessing;
var run = new Run(
new RunProperties(
new Bold(),
new RunPropertiesChange
{
Id = 2,
Author = "Bob",
Date = "2024-02-01T09:00:00Z",
}.Append(new RunProperties()) // empty = was not bold
),
new Text("Bold text with tracked formatting change")
);
Notes
w:rPrChangeis placed as the last child ofw:rPr.- The child
w:rPrmust not itself contain aw:rPrChange. - When accepting the change,
w:rPrChangeis removed and the current (outer) properties remain. - When rejecting, the inner properties replace the outer properties.