PptxGenJS
PptxGenJS copied to clipboard
[BUG] Slide Master placeholders do not apply valign on PowerPoint > Add Slide
Description:
When defining Master Slides and using a text placeholder with
valign: "middle"
, if I add the slide using PowerPoint > New Slide dropdown > Any defined template thevalign
is top, no matter what was passed in placeholder.
- [ ] Enhancement
- [x] Bug
- [ ] Question
- [ ] Documentation gap/issue
Product Versions
- Please specify what version of the library you are using......: [3.11.0]
- Please specify what version(s) of PowerPoint you are targeting: [PowerPoint for Microsoft 365]
- Please specify what web browser you are using.................: [Chrome]
Desired Behavior
Using PowerPoint > Add Slide to add a master slide with a text placeholder that has valign: "middle"
should produce a slide with a text area that is middle-aligned.
The master slides demo contains an example of this issue. Run Demo and open the PowerPoint to observe the behavior
From demos/modules/masters.mjs
, the "MASTER_SLIDE" placeholder has valign: "middle"
// MASTER_SLIDE (MASTER_PLACEHOLDER)
pptx.defineSlideMaster({
title: "MASTER_SLIDE",
background: { color: "E1E1E1", transparency: 50 },
margin: [0.5, 0.25, 1.0, 0.25],
slideNumber: { x: 0.6, y: 7.1, color: "FFFFFF", fontFace: "Arial", fontSize: 10, bold: true },
objects: [
//{ 'image': { x:11.45, y:5.95, w:1.67, h:0.75, data:STARLABS_LOGO_SM } },
{
rect: { x: 0.0, y: 6.9, w: "100%", h: 0.6, fill: { color: "003b75" } },
},
{
text: {
options: { x: 0, y: 6.9, w: "100%", h: 0.6, align: "center", valign: "middle", color: "FFFFFF", fontSize: 12 },
text: "S.T.A.R. Laboratories - Confidential",
},
},
{
placeholder: {
options: {
name: "header",
type: "title",
x: 0.6,
y: 0.2,
w: 12,
h: 1.0,
margin: 0,
align: "center",
valign: "middle",
color: "404040",
//fontSize: 18,
},
text: "", // USAGE: Leave blank to have powerpoint substitute default placeholder text (ex: "Click to add title")
},
},
{
placeholder: {
options: { name: "body", type: "body", x: 0.6, y: 1.5, w: 12, h: 5.25, fontSize: 28 },
text: "(supports custom placeholder text!)",
},
},
],
});
Observed Behavior
Though the valign: "middle"
does properly apply when using .addSlide({ masterName: "MASTER_SLIDE" })
, it does NOT apply when adding a slide using this master template in PowerPoint.
Steps to Reproduce
- PptxGenJS Feature Demos > Templates > Run Demo
- Open in PowerPoint
- Enable Editing
- Home > New Slide dropdown > MASTER_SLIDE
- Edit "(click to add title)" text area and see that it is top-aligned rather than middle-aligned.