打印GridWeb
Contents
[
Hide
]
有时开发人员需要从Web页面打印GridWeb内容,而不是将结果保存为Microsoft Excel电子表格文件。Aspose.Cells.GridWeb控件通过客户端函数支持此功能。
打印 GridWeb
为了打印内容,Aspose.Cells.GridWeb for .NET已经公开了GridWeb.Print客户端函数,可以在JavaScript调用中使用,如下所示。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
<script> | |
function Print(grid) { | |
// Get Id of GridWeb | |
var grid = document.getElementById('<%= GridWeb1.ClientID %>'); | |
// Call print | |
grid.print(); | |
} | |
</script> |
一旦JavaScript函数就位,就可以在选择的任何事件上触发它。请检查以下ASP.NET片段,它在按钮单击事件中使用了上述定义的JavaScript函数。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
<asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="Print();return false;" /> |