Print GridWeb
Contents
[
Hide
]
There are times when developers need to print the GridWeb contents from a web page without saving the result as Microsoft Excel spreadsheet file. The Aspose.Cells.GridWeb control supports this feature via client side function.
Printing GridWeb
In order to print the contents, the Aspose.Cells.GridWeb for .NET has exposed the GridWeb.Print client-side function which can be used in a JavaScript call as demonstrated below.
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> |
Once the JavaScript function is in place, it can be triggered on any event of choice. Please check the following ASP.NET snippet which uses the above defined JavaScript function on a button click event.
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;" /> |