列ヘッダーのヒントを設定する
Contents
[
Hide
]
考えられる使用シナリオ
ワークシートでテーブルを作成するときに、カスタム列のツールヒントを設定する必要がある場合があります。 Aspose.Cells.GridWeb では、列のキャプションの名前を変更したり、列にツールチップを設定したりできるため、ユーザーは列の目的を簡単に理解できます。
列ヘッダーのヒントの設定
列のキャプションを変更し、ツールチップ テキストを適用する方法を示す完全な例を以下に示します。上記のサンプル コードを実行した後、指定した列のヘッダーにマウス カーソルを合わせると、次のようにツールヒント テキストが表示されます。
サンプルコード
のサンプル スクリプトは次のとおりです。ASPXページ.
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 | |
<form id="form1" runat="server"> | |
<div> | |
<acw:GridWeb ID="GridWeb1" runat="server" XhtmlMode="True" Height="350px" Width="700px"> | |
</acw:GridWeb> | |
</div> | |
</form> |
のサンプルコードはこちらASPX コード ビハインド CS ファイル.
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 | |
//Access the first worksheet | |
GridWorksheet gridSheet = GridWeb1.WorkSheets[0]; | |
//Input data into the cells of the first worksheet. | |
gridSheet.Cells["A1"].PutValue("Product1"); | |
gridSheet.Cells["A2"].PutValue("Product2"); | |
gridSheet.Cells["A3"].PutValue("Product3"); | |
gridSheet.Cells["A4"].PutValue("Product4"); | |
gridSheet.Cells["B1"].PutValue(100); | |
gridSheet.Cells["B2"].PutValue(200); | |
gridSheet.Cells["B3"].PutValue(300); | |
gridSheet.Cells["B4"].PutValue(400); | |
//Set the caption of the first two columns. | |
gridSheet.SetColumnCaption(0, "Product Name"); | |
gridSheet.SetColumnCaption(1, "Price"); | |
//Set the column width of the first column. | |
gridSheet.Cells.SetColumnWidth(0, 20); | |
//Set the second column header's tip. | |
gridSheet.SetColumnHeaderToolTip(1, "Unit Price of Products"); | |