MCPcopy Index your code
hub / github.com/simstudioai/sim / parseCell

Function parseCell

apps/sim/lib/pptx-renderer/model/nodes/table-node.ts:37–58  ·  view source on GitHub ↗

* Parse a single table cell (`a:tc`).

(tcNode: SafeXmlNode)

Source from the content-addressed store, hash-verified

35 * Parse a single table cell (`a:tc`).
36 */
37function 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`).

Callers 1

parseRowFunction · 0.85

Calls 5

parseTextBodyFunction · 0.90
numAttrMethod · 0.80
attrMethod · 0.80
childMethod · 0.80
existsMethod · 0.80

Tested by

no test coverage detected