Skip to content

v9.5.2 - Fix inter-row and body-level bookmark preservation

Choose a tag to compare

@ItMeDiaTech ItMeDiaTech released this 26 Jan 00:46
· 81 commits to main since this release

What's Changed

Fixes document corruption caused by bookmark elements appearing between table rows or body-level paragraphs.

Bug Fixes

  • Fix inter-row bookmark preservation - Per ECMA-376, elements like w:bookmarkEnd can appear between w:tr elements in tables. The Table class now preserves these elements during round-trip processing.
  • Fix body-level bookmark preservation - Bookmark start elements that appear between paragraphs (outside of tables) are now captured and attached to the following paragraph.

New API

Inter-Row Content Methods (Table class)

// Add content between rows
table.addInterRowContent(afterRowIndex, '<w:bookmarkEnd w:id="107"/>', 'bookmarkEnd');

// Get all inter-row content
const content = table.getInterRowContent();

// Get content after specific row
const afterRow2 = table.getInterRowContentAfterRow(2);

// Clear all inter-row content
table.clearInterRowContent();

Technical Details

  • Introduced InterRowContent interface for type-safe inter-row element storage
  • DocumentParser now extracts inter-row elements via extractInterRowElements()
  • DocumentParser now captures body-level bookmarkStart via extractBodyLevelBookmarkStarts()
  • Table.toXML() outputs inter-row content in correct positions using raw XML passthrough

Full Changelog: v9.5.1...v9.5.2