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

Allow custom Layout sizes (ex: A3) #29

Closed
itskun opened this issue Feb 1, 2017 · 5 comments
Closed

Allow custom Layout sizes (ex: A3) #29

itskun opened this issue Feb 1, 2017 · 5 comments
Assignees
Milestone

Comments

@itskun
Copy link

itskun commented Feb 1, 2017

I would like to see in your wonderful project such new features:

  • A3 layout format
  • images in table cells
  • text multiformatting in single table cells
@itskun itskun changed the title A3 format Some new requests Feb 1, 2017
@gitbrent gitbrent self-assigned this Feb 1, 2017
@gitbrent gitbrent changed the title Some new requests Allow custom Layout sizes (ex: A3) Feb 4, 2017
gitbrent pushed a commit that referenced this issue Feb 5, 2017
@gitbrent
Copy link
Owner

gitbrent commented Feb 5, 2017

Hi @itskun ,

You can now specify any layout size you want using the existing setLayout() method.

Just pass a name/width/height and all the Slides in the that Presentation will be your layout size:

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

@gitbrent gitbrent added this to the v1.2.0 milestone Feb 5, 2017
@itskun
Copy link
Author

itskun commented Feb 6, 2017

Thank you, @gitbrent !
There is issue, with this - when I'm trying to set layout, there appears a message:

PowerPoint found unreadable content in Presentation.pptx. Do you want to recover the contects of this presentation? If you trust the source of this presentation, click Yes.

So when I changed 'LAYOUT_16x9' line 92 at pptgen.js
gObjPptx.pptLayout = LAYOUTS['LAYOUT_16x9'];
to another layout name, presentation file opened without errors.

gitbrent pushed a commit that referenced this issue Feb 10, 2017
PPT is very particular about slide layout names.
@gitbrent
Copy link
Owner

Hi @itskun ,

Sure enough there was an issue with the name value in the Slide Layout XML tags.

It's been fixed now and an A3 opens for me in PowerPoint without errors now.

@badlee
Copy link

badlee commented Jun 25, 2017

I haved same bug (PowerPoint need recover) when I want set A4 layout.

pptx.setLayout({ name: 'A4', width:10.834645669, height:7.5 });

When I'm trying to set layout, there appears a message:

PowerPoint found unreadable content in Presentation.pptx. Do you want to recover the contects of this presentation? If you trust the source of this presentation, click Yes.

I solved it, by change two lines at pptgen.js

/*2620*/ LAYOUTS['LAYOUT_USER'].width  = Number(inLayout.width ) * EMU;
/*2621*/ LAYOUTS['LAYOUT_USER'].height = Number(inLayout.height) * EMU;

to this

/*2620*/ LAYOUTS['LAYOUT_USER'].width  = Math.round(Number(inLayout.width ) * EMU);
/*2621*/ LAYOUTS['LAYOUT_USER'].height = Math.round(Number(inLayout.height) * EMU);

The width or the height must be an integer not a float.

gitbrent pushed a commit that referenced this issue Jun 25, 2017
@gitbrent
Copy link
Owner

Hi @badlee ,

Thanks for the info! I've added rounding to the width and height so this won't be an issue going forward.

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

3 participants