Set Column Header Tip

Possible Usage Scenarios

You might need to set tooltip for your custom column while creating the table in the worksheet. Aspose.Cells.GridWeb allows you to rename a column’s caption and you may set tooltip to the column, so the users could easily understand what is the column for.

Setting Column Header Tip

A complete example is given below to demonstrate how to change columns' captions and apply tooltip text. After executing the above example code, tooltip text would be popped out when you place the mouse cursor over the specified column’s header as shown below.

todo:image_alt_text

Sample Code

Here is the sample script of the ASPX Page.

// 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>

Here is the sample code of the ASPX Code Behind CS File.

// 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");