0

I am figuring out how to do a graph screenshot from webpage and download the graph as excel like this image

Graph excel https://i.stack.imgur.com/AtLHz.png]

Does anyone have any idea on that?

Alternatively, I tried downloading the graph by calling out the method but it does not have the data points, hence only have the border of the graph, which is wrong.

Hence, does anyone knows how to do screenshot? Thanks for your help!.

Vannessa
  • 11
  • 4

2 Answers2

0

For screenshot, you could follow this tutorial Capture a Screen Shot For exporting graph to excel, refer to this Export Excel Chart

M. Adeel Khalid
  • 1,786
  • 2
  • 21
  • 24
0

I don't have the full working solution, but I think it should able to guide you to code your own solution.

Take a screenshot in web browser

I should clarify that we cannot have any screenshot. But we can generate a picture of a component as a screenshot.

$(function() { 
    $("#btnSave").click(function() { 
        html2canvas($("#widget"), {
            onrendered: function(canvas) {
                theCanvas = canvas;

                canvas.toBlob(function(blob) {
                    // If you okay with export as image, this is end
                    saveAs(blob, "Dashboard.png"); 
                    // otherwise, comment above line, and post it back to server
                });
            }
        });
    });
});

Full discussion can be found here: https://stackoverflow.com/a/24619118/1050927

Paste image into Excel file

After you post the blob (as file, example here), you can get that in server, and use Microsoft Office API or other API to create an Excel file and paste it into excel

Return Excel file to user

After you have done that, return the excel file back to user.

Community
  • 1
  • 1
Prisoner
  • 1,839
  • 2
  • 22
  • 38