* Parse a single table cell (`a:tc`).
(tcNode: SafeXmlNode)
| 35 | * Parse a single table cell (`a:tc`). |
| 36 | */ |
| 37 | function parseCell(tcNode: SafeXmlNode): TableCell { |
| 38 | const gridSpan = tcNode.numAttr('gridSpan') ?? 1 |
| 39 | const rowSpan = tcNode.numAttr('rowSpan') ?? 1 |
| 40 | const hMerge = tcNode.attr('hMerge') === '1' || tcNode.attr('hMerge') === 'true' |
| 41 | const vMerge = tcNode.attr('vMerge') === '1' || tcNode.attr('vMerge') === 'true' |
| 42 | |
| 43 | // Cell text body |
| 44 | const txBody = tcNode.child('txBody') |
| 45 | const textBody = parseTextBody(txBody) |
| 46 | |
| 47 | // Cell properties |
| 48 | const tcPr = tcNode.child('tcPr') |
| 49 | |
| 50 | return { |
| 51 | gridSpan, |
| 52 | rowSpan, |
| 53 | hMerge, |
| 54 | vMerge, |
| 55 | textBody, |
| 56 | properties: tcPr.exists() ? tcPr : undefined, |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Parse a table row (`a:tr`). |