Hi ,
How to import the pptxgenjs in the react app . i have installed it via npm . But not sure how to import it in the file .
I am getting the PptxGenJS() as undefined . i am using the version 2.0.0 .
Thanks .
Hi @gitbrent , Any update on this ?
There's a couple Issues open for Angular/React at the moment, but i'm unable to produce a test case as i dont use either.
I use this in Node.js:
var pptx = require("pptxgenjs");
This works in angular:
const PptxGenJS = require('pptxgenjs');
const pptx = new PptxGenJS();
pptx.setBrowser(true);
export function generatePPT() {
const slide = pptx.addNewSlide();
const opts = { x: 1.0, y: 1.0, font_size: 42, color: '00FF00' };
slide.addText('Hello World!', opts);
pptx.save();
}
@sriganeshharitz Thanks man!
This also works in Vue!
I have tested it in React and it works as expected. I followed a similar approach to @sriganeshharitz by simply creating a generatePPI() method in the component and using an onClick handler which calls the method. If you have any trouble let me know and I can show my code.
Edit: As per the documentation it's also very important to include "pptx.setBrowser(true)" or you may run into some problems
Thanks everyone!
Example code and link to this Issue have been added to the API docs:
Most helpful comment
This works in angular: