Skriv ut GridWeb
Contents
[
Hide
]
Det finns tillfällen då utvecklare behöver skriva ut GridWeb-innehållet från en webbsida utan att spara resultatet som Microsoft Excel-kalkylarksfil. Aspose.Cells.GridWeb-kontrollen stöder denna funktion via klientsidans funktion.
Utskrift GridWeb
För att skriva ut innehållet har Aspose.Cells.GridWeb for .NET avslöjat funktionen GridWeb.Print på klientsidan som kan användas i ett JavaScript-anrop som visas nedan.
This file contains hidden or 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> |
När JavaScript-funktionen är på plats kan den utlösas vid valfri händelse. Kontrollera följande ASP.NET-kodavsnitt som använder den ovan definierade JavaScript-funktionen på en knappklickshändelse.
This file contains hidden or 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;" /> |