Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions demos/modules/masters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 6 additions & 8 deletions src/gen-xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<a:buSzPct val="100000"/><a:buFont typeface="+mj-lt"/><a:buAutoNum type="${textObj.options.bullet.style || 'arabicPeriod'}" startAt="${textObj.options.bullet.numberStartAt || textObj.options.bullet.startAt || '1'
}"/>`
}
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 = `<a:buSzPct val="100000"/><a:buFont typeface="+mj-lt"/><a:buAutoNum type="${textObj.options.bullet.style || 'arabicPeriod'}" startAt="${textObj.options.bullet.numberStartAt || textObj.options.bullet.startAt || '1'
}"/>`
} else if (textObj.options.bullet.characterCode) {
let bulletCode = `&#x${textObj.options.bullet.characterCode};`

Expand Down Expand Up @@ -1071,7 +1069,7 @@ function genXmlTextRun (textObj: TextProps): string {
function genXmlBodyProperties (slideObject: ISlideObject | TableCell): string {
let bodyProperties = '<a:bodyPr'

if (slideObject && slideObject._type === SLIDE_OBJECT_TYPES.text && slideObject.options._bodyProp) {
if (slideObject && (slideObject._type === SLIDE_OBJECT_TYPES.text || slideObject._type === SLIDE_OBJECT_TYPES.placeholder) && slideObject.options._bodyProp) {
// PPT-2019 EX: <a:bodyPr wrap="square" lIns="1270" tIns="1270" rIns="1270" bIns="1270" rtlCol="0" anchor="ctr"/>

// A: Enable or disable textwrapping none or square
Expand Down