You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Migration Target**: Replace HTML fallback with pure OOXML generation
168
+
***Pure Formatting Mode (Surgical)**: For formatting-only changes (Bold, Italic, U, Strike), the engine modifies `w:rPr` in place and uses `w:rPrChange` for redlines. This is the **preferred high-fidelity path**.
169
+
***Reconstruction Mode**: For combined text and formatting edits, or complex list/table generation. It reconstructs paragraphs and applies explicit `w:val="1"` attributes.
170
+
***HTML Fallback (Deprecated)**: Used for simple text updates.
171
+
***Migration Target**: Fully eliminate HTML fallback and rely on Pure Formatting and Reconstruction modes for all edits.
Copy file name to clipboardExpand all lines: OOXML_ARCHITECTURE.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This document outlines the architecture of the **OOXML Reconciliation Engine**,
7
7
The system operates in two distinct modes depending on the complexity of the operation:
8
8
9
9
1.**Reconstruction Pipeline** (Standard): Parses original OOXML, diffs against new text, and rebuilds the paragraph from scratch. Used for standard text edits and list generation.
10
-
2.**Surgical Hybrid Engine** (Complex): Direct DOM manipulation. Used for Tables (to preserve cell structure) and specific "Highlight" and "Format Removal" operations.
10
+
2.**Surgical Hybrid Engine** (Complex): Direct DOM manipulation. Used for Tables (to preserve cell structure) and **Pure Formatting Changes** (Bold, Italic, etc.) to ensure clean redlines.
11
11
12
12
```mermaid
13
13
graph TD
@@ -43,8 +43,9 @@ The OOXML engine currently handles the following operations without Word JS API
43
43
3.**List Generation**: Complex nested lists with custom numbering styles
44
44
4.**Table Generation**: Complete table creation and modification
45
45
5.**Format Preservation**: Maintains existing document formatting during edits
46
-
6.**Track Changes**: Generates proper `w:ins`/`w:del` elements for redlines
47
-
7.**Comment Preservation**: Maintains comment positions during text edits
46
+
6.**Pure Formatting Redlines**: Generates `w:rPrChange` elements for clean formatting-only changes (Bold, Italic, U, Strike)
47
+
7.**Track Changes**: Generates proper `w:ins`/`w:del` elements for text edits
48
+
8.**Comment Preservation**: Maintains comment positions during text edits
48
49
49
50
### 🚧 Hybrid Operations (Partial OOXML)
50
51
@@ -160,12 +161,11 @@ To reconcile tables, the engine converts the hierarchical XML (`w:tr` -> `w:tc`)
160
161
* The `applyHighlightToOoxml` function (in `ooxml-formatting-removal.js`) performs targeted XML modification to inject `w:highlight` tags into specific runs.
161
162
* This bypasses the reconstruction pipeline for high-speed, structural-preserving formatting updates.
***Workaround**: To "Redline" a format removal (e.g., un-bolding), the engine treats it as a text replacement:
166
-
*`<w:del><strong>Text</strong></w:del>`
167
-
*`<w:ins>Text</w:ins>`
168
-
* This forces Word to show the change visibly as a deletion of the bold text and insertion of plain text.
164
+
***Pure Formatting Changes**:
165
+
* To ensure formatting changes (e.g., adding or removing Bold) appear as native "Formatting" edits in Word rather than "Delete + Insert" redlines, the engine uses **Surgical Property Modification**.
166
+
***Mechanism**: Directly modifies the `<w:rPr>` element and injects a `<w:rPrChange>` snapshot.
167
+
***High Fidelity**: This allows Word to display clean formatting signals in the Track Changes pane.
168
+
***Functions**: `applyFormatAdditionsAsSurgicalReplacement` and `applyFormatRemovalAsSurgicalReplacement`.
169
169
170
170
### Comment & Range Preservation
171
171
***Position Markers**: Elements like `w:commentRangeStart/End` are treated as zero-width position markers during ingestion.
0 commit comments