Description
When a slide has a solid color background (via slide.background = { color: '...' }), the generated <p:bgPr> element is missing the <a:effectLst/> child element. PowerPoint expects this element and triggers the repair dialog when it is absent.
Root Cause
In gen-objects.ts (compiled: pptxgen.cjs.js around L5103):
// Image backgrounds correctly include <a:effectLst/>:
strSlideXml += `<p:bg><p:bgPr><a:blipFill ...><a:effectLst/></p:bgPr></p:bg>`;
// But solid color backgrounds do NOT:
strSlideXml += `<p:bg><p:bgPr>${genXmlColorSelection(slide.background)}</p:bgPr></p:bg>`;
// ^^^ missing <a:effectLst/>
The image background path includes <a:effectLst/> but the solid color path does not.
Steps to Reproduce
- Create a slide with a solid color background:
slide.background = { color: 'FF0000' }
- Generate the .pptx
- Open in Microsoft PowerPoint → repair dialog appears
- Diff original vs repaired file:
<a:effectLst/> is added inside <p:bgPr>
Expected Behavior
Solid color backgrounds should include <a:effectLst/>, consistent with image backgrounds:
<p:bg><p:bgPr><a:solidFill><a:srgbClr val="FF0000"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>
Suggested Fix
strSlideXml += `<p:bg><p:bgPr>${genXmlColorSelection(slide.background)}<a:effectLst/></p:bgPr></p:bg>`;
Environment
- PptxGenJS: 4.0.1
- PowerPoint for Mac (Microsoft 365)
- Node.js 22.x
Description
When a slide has a solid color background (via
slide.background = { color: '...' }), the generated<p:bgPr>element is missing the<a:effectLst/>child element. PowerPoint expects this element and triggers the repair dialog when it is absent.Root Cause
In
gen-objects.ts(compiled:pptxgen.cjs.jsaround L5103):The image background path includes
<a:effectLst/>but the solid color path does not.Steps to Reproduce
slide.background = { color: 'FF0000' }<a:effectLst/>is added inside<p:bgPr>Expected Behavior
Solid color backgrounds should include
<a:effectLst/>, consistent with image backgrounds:Suggested Fix
Environment