* Find a table style node by its ID from presentation.tableStyles. * tableStyles XML structure:
( tableStyleId: string | undefined, ctx: RenderContext )
| 27 | * tableStyles XML structure: <a:tblStyleLst> <a:tblStyle styleId="{UUID}" ...> |
| 28 | */ |
| 29 | function 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. |
no test coverage detected