简体   繁体   English

如何从网页截屏并以Excel ASP.NET CS格式下载

[英]How to do screenshot from webpage and download as excel ASP.NET CS

I am figuring out how to do a graph screenshot from webpage and download the graph as excel like this image 我正在弄清楚如何从网页上制作图形屏幕截图并像这张图片一样以excel格式下载图形

Graph excel https://i.stack.imgur.com/AtLHz.png] 图表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!. 谢谢你的帮助!。

有关屏幕截图,您可以按照本教程进行操作。 捕获屏幕快照有关将图形导出为ex​​cel的信息,请参阅此Export Excel Chart

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 可以在这里找到完整的讨论: https : //stackoverflow.com/a/24619118/1050927

Paste image into Excel file 将图像粘贴到Excel文件中

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 发布Blob(作为文件, 此处示例 )之后,您可以在服务器中获取该Blob,并使用Microsoft Office API或其他API创建Excel文件并将其粘贴到excel中

Return Excel file to user 将Excel文件返回给用户

After you have done that, return the excel file back to user. 完成此操作后,将excel文件返回给用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM