PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

[BUG] Slide Master placeholders do not apply valign on PowerPoint > Add Slide

Open missiontide opened this issue 2 years ago • 1 comments

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 the valign 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.

image

image

Steps to Reproduce

  1. PptxGenJS Feature Demos > Templates > Run Demo
  2. Open in PowerPoint
  3. Enable Editing
  4. Home > New Slide dropdown > MASTER_SLIDE
  5. Edit "(click to add title)" text area and see that it is top-aligned rather than middle-aligned.

missiontide avatar Jan 05 '23 11:01 missiontide