We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
You can directly change the xmlObject.
function setPageNumStyle(slide, style){ let pageNumElement = slide.powerPointFactory.pptFactory.slideFactory.content[`ppt/slides/${slide.name}.xml`]['p:sld']['p:cSld'][0]['p:spTree'][0]['p:sp'][0]; let fld = pageNumElement['p:txBody'][0]['a:p'][0]['a:fld'][0]; let styleData = {$: fld['a:rPr'][0].$}; if(style.fontSize !== undefined) styleData.$.sz = style.fontSize * 100; if(style.fontBold !== undefined) styleData.$.b = style.fontBold ? 1 : 0; if(style.fontItalic !== undefined) styleData.$.i = style.fontItalic ? 1 : 0; if(style.fontUnderline !== undefined) styleData.$.u = style.fontUnderline ? 'sng' : 0; if(style.textColor) styleData['a:solidFill'] = [{'a:srgbClr': [{$: {val: style.textColor}}]}]; if(style.fontFace){ let fontFaceAttribute = [{$: {typeface: style.fontFace, pitchFamily: 0, charset: 0}}]; styleData['a:latin'] = fontFaceAttribute; styleData['a:cs'] = fontFaceAttribute; } fld['a:rPr'][0] = styleData; }
Here's how the function works.
const PPTX = require('nodejs-pptx'); let pptx = new PPTX.Composer(); await pptx.compose(async pres => { await pres.addSlide(slide => { setPageNumStyle(slide, { fontFace: 'Abadi', fontSize: 15, fontBold: true, fontItalic: false, fontUnderline: true, textColor: '000000', }); }); }); await pptx.save(`./set-page-num-style.pptx`);
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: