GridWebを印刷する
Contents
[
Hide
]
開発者が、結果をMicrosoft Excel のスプレッドシートファイルとして保存せずに、Web ページから GridWeb の内容を印刷する必要がある場合があります。Aspose.Cells.GridWeb コントロールは、クライアント側の機能を介してこの機能をサポートしています。
GridWeb の印刷
Aspose.Cells.GridWeb for .NET では、以下に示すように、JavaScript の呼び出しで使用される GridWeb.Print クライアント側機能が公開されています。
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;" /> |