0

I'm using node, express to create a web dashboard and created my charts with ChartJS. Now I want to export them in powerpoint in one click (1 page can have 6-10 graphs/charts)

I saw PPTxGen JS is recommend for exporting in PPT but I cannot figure out how to connect with my existing chartJs.

Can please help?

Thanks in advance.

Karen89
  • 21
  • 4

1 Answers1

1

You can add a button that calls a function, that will get the canvas object, then you can get the dataUrl of the canvas and add that as an image to your powerpoint. Here is a small example:

<canvas id="myChart" width="400" height="400"></canvas>
<script>
    var canvas = document.getElementById('myChart').getCanvas();
    var dataUrl = canvas.toDataUrl();
    var pptx = new PptxGenJs();
    var slide = pptx.addNewSlide();
    slide.addImage({data: dataUrl});
    pptx.save("test.pptx");
</script>
Rami
  • 11
  • 1