From 3e1289537b6f22be4a45865fc8cf56b27bb1dad4 Mon Sep 17 00:00:00 2001 From: MikeMeerschaert Date: Wed, 26 Apr 2023 10:13:20 -0700 Subject: [PATCH 1/3] added example showing that bullet font and characterCode is not respected in placeholder. --- demos/modules/masters.mjs | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/demos/modules/masters.mjs b/demos/modules/masters.mjs index e2c4d6e34..df1544b09 100644 --- a/demos/modules/masters.mjs +++ b/demos/modules/masters.mjs @@ -124,6 +124,49 @@ export function createMasterSlides(pptx) { ], }); + // MASTER_WITH_BULLETS + pptx.defineSlideMaster({ + title: "MASTER_WITH_BULLETS", + 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: [ + { + 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: "bullets", type: "body", x: 0.6, y: 1.5, w: 12, h: 5.25, fontSize: 14, fontFace: "arial", bullet: { type: "bullet", characterCode: "25CF" } }, + text: "Bullet 1\nBullet 2\nBullet 3\nBullet 4\nBullet 5", + }, + }, + ], + }); + // THANKS_SLIDE (THANKS_PLACEHOLDER) pptx.defineSlideMaster({ title: "THANKS_SLIDE", From bab340ebe5f0484feb5bda94b3bb930e30513fe3 Mon Sep 17 00:00:00 2001 From: MikeMeerschaert Date: Wed, 26 Apr 2023 12:37:16 -0700 Subject: [PATCH 2/3] added fix placeholder valign and margin options pass through to XML --- src/gen-xml.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gen-xml.ts b/src/gen-xml.ts index e1f0aea13..b080d2bb2 100644 --- a/src/gen-xml.ts +++ b/src/gen-xml.ts @@ -1071,7 +1071,7 @@ function genXmlTextRun (textObj: TextProps): string { function genXmlBodyProperties (slideObject: ISlideObject | TableCell): string { let bodyProperties = ' // A: Enable or disable textwrapping none or square From e1d6c39c8c33d7f20c6b53a4cab116d839609d3f Mon Sep 17 00:00:00 2001 From: MikeMeerschaert Date: Wed, 26 Apr 2023 12:54:31 -0700 Subject: [PATCH 3/3] fixed issue where supplying bullet.type = 'bullet' would cause the rest of the bullet formatting to be disregarded. --- src/gen-xml.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gen-xml.ts b/src/gen-xml.ts index b080d2bb2..89398de90 100644 --- a/src/gen-xml.ts +++ b/src/gen-xml.ts @@ -885,13 +885,11 @@ function genXmlParagraphProperties (textObj: ISlideObject | TextProps, isDefault if (typeof textObj.options.bullet === 'object') { if (textObj?.options?.bullet?.indent) bulletMarL = valToPts(textObj.options.bullet.indent) - if (textObj.options.bullet.type) { - if (textObj.options.bullet.type.toString().toLowerCase() === 'number') { - paragraphPropXml += ` marL="${textObj.options.indentLevel && textObj.options.indentLevel > 0 ? bulletMarL + bulletMarL * textObj.options.indentLevel : bulletMarL - }" indent="-${bulletMarL}"` - strXmlBullet = `` - } + if (textObj.options.bullet.type && textObj.options.bullet.type.toString().toLowerCase() === 'number') { + paragraphPropXml += ` marL="${textObj.options.indentLevel && textObj.options.indentLevel > 0 ? bulletMarL + bulletMarL * textObj.options.indentLevel : bulletMarL + }" indent="-${bulletMarL}"` + strXmlBullet = `` } else if (textObj.options.bullet.characterCode) { let bulletCode = `&#x${textObj.options.bullet.characterCode};`