* Extract the table style ID from tblPr. * It can be in `a:tblStyle@val` or as a direct `tblStyle` attribute.
(tblPr: SafeXmlNode)
| 86 | * It can be in `a:tblStyle@val` or as a direct `tblStyle` attribute. |
| 87 | */ |
| 88 | function extractTableStyleId(tblPr: SafeXmlNode): string | undefined { |
| 89 | // Try <a:tableStyleId>{UUID}</a:tableStyleId> (most common in OOXML) |
| 90 | const tableStyleIdNode = tblPr.child('tableStyleId') |
| 91 | if (tableStyleIdNode.exists()) { |
| 92 | return tableStyleIdNode.text() || tableStyleIdNode.attr('val') || undefined |
| 93 | } |
| 94 | // Try <a:tblStyle val="{UUID}"/> |
| 95 | const tblStyleNode = tblPr.child('tblStyle') |
| 96 | if (tblStyleNode.exists()) { |
| 97 | return tblStyleNode.attr('val') ?? (tblStyleNode.text() || undefined) |
| 98 | } |
| 99 | // Try direct attribute |
| 100 | return tblPr.attr('tblStyle') ?? undefined |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Parse a graphicFrame XML node containing a table into TableNodeData. |
no test coverage detected