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

Take pptxgenjs JSON (prop?) as alternative to presentation child #699

Open
MP70 opened this issue Feb 4, 2024 · 3 comments
Open

Take pptxgenjs JSON (prop?) as alternative to presentation child #699

MP70 opened this issue Feb 4, 2024 · 3 comments

Comments

@MP70
Copy link

MP70 commented Feb 4, 2024

Is there a way to do this already, or would you accept a PR?

@wyozi
Copy link
Owner

wyozi commented Feb 4, 2024

What's the use case for this? I think some kind of escape hatch to be able to use pptxgenjs directly could be good, but replacing Presentation with a json sounds like quite a big change

@MP70
Copy link
Author

MP70 commented Feb 4, 2024

If we are programatically generating or modifying this pptxjs json server side, then we have to ship the json to the FE then translate this into jsx 'by hand' in order to display it.

For example, imagine I'm storing a bunch of template json in a database; the user selects which 'template' slides they want in what order, then we fill out some variables and now wish to display it.

We may also need to generate the output pptxs on the server side, so we can't just write all our pptx templates in jsx.

@wyozi
Copy link
Owner

wyozi commented Feb 4, 2024

Tbh it feels like something that doesn't belong to this core library: the JSON format brings its own implicit versioning and acts as a completely complimentary feature. I'd say translating the JSON into JSX by hand is actually the right approach here. As far as I know, pptxgenjs doesn't offer any kind of JSON serialization features either, so it'd have to be implemented separately for it anyway.

I'd suggest creating your own library that can handle conversions from JSON to react-pptx JSX (and I suppose raw pptxgenjs calls as well for serverside usage?). If you make it public, I'd be happy to link to it from the README as well

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

No branches or pull requests

2 participants