Skip to content
New issue

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

Broken pptx has generated if used custom slide layout in v3.3.0 #826

Closed
1 of 4 tasks
yhatt opened this issue Aug 20, 2020 · 1 comment
Closed
1 of 4 tasks

Broken pptx has generated if used custom slide layout in v3.3.0 #826

yhatt opened this issue Aug 20, 2020 · 1 comment
Assignees
Milestone

Comments

@yhatt
Copy link

yhatt commented Aug 20, 2020

Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: v3.3.0

Please specify what version(s) of PowerPoint you are targeting: PowerPoint 16.40, Keynote 10.1

Expected

If used the custom slide layout defined through defineLayout(), the output pptx should show the slide with the correct size defined in layout.

Observed Behavior

A broken pptx will be generated if used the custom slide layout in PptxGenJS v3.3.0.

PowerPoint will be trying to repair it but the result has different layout size. Keynote will show nothing.

Steps to Reproduce

Run this script in Node.js and open pptx.pptx:

const PptxGenJS = require('pptxgenjs')
const pptx = new PptxGenJS()

pptx.defineLayout({ name: 'A3', width: 16.5, height: 11.7 })

// console.dir(pptx.presLayout)
pptx.layout = 'A3'
// console.dir(pptx.presLayout)

pptx.addSlide()
pptx.writeFile('pptx.pptx')

Appendix

  • This script works correctly with v3.2.1.
  • v3.3.0 + built-in layout such as LAYOUT_4x3 also will work.
  • Workaround: Assign width and height to pptx.presLayout manually after assigning layout.
pptx.layout = 'A3'
pptx.presLayout.width = pptx.presLayout._sizeW
pptx.presLayout.height = pptx.presLayout._sizeH
@gitbrent
Copy link
Owner

Thanks @yhatt - I thought there was a test case for defineLayout(), but I was mistaken.

Issue was due to lose type definitions not catching recent changes to SlideLayout props in 3.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants