<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="QX">
        <div id="chart-container"></div>
        <!-- Highcharts will render the chart here -->
    </div>
    <button id="exportPPT">Export to PPT</button>

    <script src="https://code.highcharts.com/highcharts.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdn.jsdelivr.net/npm/pptxgenjs@3.3.1/dist/pptxgen.bundle.js"></script>

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            // Create Highcharts chart
            Highcharts.chart('chart-container', {
                chart: { type: 'column' },
                title: { text: 'Sample Column Chart' },
                xAxis: { categories: ['Apples', 'Oranges', 'Pears'] },
                yAxis: { title: { text: 'Fruit eaten' }},
                series: [{ name: 'John', data: [1, 4, 3] }]
            });

            // Export to PPT functionality
            document.getElementById('exportPPT').addEventListener('click', function () {
                // Convert QX div to canvas
                html2canvas(document.getElementById('QX'), {
                    onrendered: function (canvas) {
                        // Get image data
                        var imgData = canvas.toDataURL('image/png');
                        
                        // Create a new PPT
                        var ppt = new PptxGenJS();
                        var slide = ppt.addSlide();
                        
                        // Add the image to the PPT slide
                        slide.addImage({ data: imgData, x: 0.5, y: 0.5, w: 9, h: 5 });

                        // Download the PPT
                        ppt.writeFile('ExportedPresentation.pptx');
                    }
                });
            });
        });

    </script>
</body>
</html>