# UnifiedWriter dev-5.30.0 DOCX Import Level 3: Table / Section / Page Setup Foundation

## Purpose

This milestone extends the OOXML-first DOCX importer beyond paragraphs, inline runs, numbering and images.  The goal is not full Microsoft Word parity yet; it is to preserve the important Level 3 structures in the UnifiedWriter DocumentModel without falling back to a lossy DOCX-to-plain-HTML conversion.

## Implemented scope

- `word/document.xml` table blocks are imported as real `<table>` blocks instead of flattened text placeholders.
- Basic table rows, cells, `gridSpan`/`colspan`, cell width, shading and vertical alignment metadata are preserved where possible.
- Section properties are inspected from `w:sectPr`.
- Page size, orientation and margins are mapped from OOXML twips into UnifiedWriter page CSS variables.
- Header/footer relationship parts are detected and imported as visible placeholders/diagnostics, not as fully editable page header/footer regions yet.
- The right-pane Feature Map / DOCX report shows Level 3 diagnostics, including table count, cell count, section/page setup information and header/footer counts.

## Design notes

UnifiedWriter still treats the visible document DOM as renderer output.  DOCX import therefore maps OOXML into model-owned blocks and metadata first.  Table cell editing, header/footer editing and multi-section layout are intentionally staged for later SelectionController and LayoutEngine work.

## Known limitations

- Table cells render and persist but do not yet support full cell-range selection, merge/split commands or table property editing.
- Vertical merges are marked with metadata and diagnostics, but not yet converted to exact rowspan layout.
- Multiple DOCX sections are detected; the last effective section page setup is applied globally to the current UnifiedWriter document.
- Header/footer content is imported as placeholder paragraphs until native header/footer model support is implemented.
- Floating images, text boxes, shapes and Word field codes remain later Level 5+ work.

## Regression checklist

1. Import a DOCX with a simple table and verify that it appears as a table, not as `cell | cell` text.
2. Import a DOCX with shaded or width-specified cells and verify that safe styling is retained.
3. Import an A4 or Letter DOCX and verify that the page dimensions remain close to the source document.
4. Import a landscape document and verify that the page is wider than tall.
5. Import a DOCX with header/footer text and verify that the diagnostics report header/footer detection.
6. Save to `.uwpsx` and reopen; table blocks should remain in the document content.

