Writer ODText: support PreserveText fields
Author: potofcoffeeCreated Aug 25, 2026Updated Aug 25, 2026
Problem
The ODText writer currently drops PHPWord PreserveText elements, including the page-number and other dynamic placeholders commonly used in headers and footers.
Expected behavior
Serialize PreserveText as native ODF content. Map supported placeholders such as {PAGE}, {NUMPAGES}, {DATE}, and {FILENAME} to ODF fields, preserve literal text and supported styling, and keep unknown placeholders literal instead of silently dropping them.
Scope
Implement this in the ODText writer using the existing PHPWord model and native ODF field elements. This is separate from the underlying ODText field support tracked in #2915.
Source: PHPOffice/PHPWord