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

Function findTableStyle

apps/sim/lib/pptx-renderer/renderer/table-renderer.ts:29–48  ·  view source on GitHub ↗

* Find a table style node by its ID from presentation.tableStyles. * tableStyles XML structure:

(
  tableStyleId: string | undefined,
  ctx: RenderContext
)

Source from the content-addressed store, hash-verified

27 * tableStyles XML structure: <a:tblStyleLst> <a:tblStyle styleId="{UUID}" ...>
28 */
29function findTableStyle(
30 tableStyleId: string | undefined,
31 ctx: RenderContext
32): SafeXmlNode | undefined {
33 if (!tableStyleId || !ctx.presentation.tableStyles) return undefined
34 const tblStyleLst = ctx.presentation.tableStyles
35 for (const style of tblStyleLst.children('tblStyle')) {
36 if (style.attr('styleId') === tableStyleId) {
37 return style
38 }
39 }
40 // Also check from root if tableStyles IS the tblStyleLst
41 for (const style of tblStyleLst.children()) {
42 if (style.localName === 'tblStyle' && style.attr('styleId') === tableStyleId) {
43 return style
44 }
45 }
46 // Fallback: check predefined (built-in) Office table styles not embedded in the PPTX
47 return getPredefinedTableStyle(tableStyleId)
48}
49
50/**
51 * Get the appropriate style section from a table style for a given cell position.

Callers 1

renderTableFunction · 0.85

Calls 3

getPredefinedTableStyleFunction · 0.90
childrenMethod · 0.80
attrMethod · 0.80

Tested by

no test coverage detected