Docx reader: improve treatment of tblHeader element.

If tblHeader exists but has `w:val="0"`, then don't consider
the element a header.

See #8299...but this change doesn't seem to fix things completely.
This commit is contained in:
John MacFarlane
2026-05-12 14:59:31 +02:00
parent 93c78e4cf6
commit b754d4da68
+6 -3
View File
@@ -764,9 +764,12 @@ elemToRow ns element | isElem ns "w" "tr" element =
let cellElems = findChildrenByName ns "w" "tc" element
let beforeCells = genericReplicate (fromMaybe 0 gridBefore) emptyCell
cells <- mapD (elemToCell ns) cellElems
let hasTblHeader = maybe NoTblHeader (const HasTblHeader)
(properties
>>= findChildByName ns "w" "tblHeader")
let hasTblHeader =
case (properties >>= findChildByName ns "w" "tblHeader") of
Nothing -> NoTblHeader
Just he -> case findAttrByName ns "w" "val" he of
Just "0" -> NoTblHeader
_ -> HasTblHeader
return $ Row hasTblHeader (beforeCells ++ cells)
elemToRow _ _ = throwError WrongElem