Search code examples
c#.nethovertooltipspire.xls

Can we add tooltip on cells in Excel sheet in .NET code with spire.xls?


Can we add tooltip on each and every cell in a particular Excel sheet in .NET code with Spire.xls?

I have googled but didn't get correct answer, though below solution didn't work for me.

Is there a way to add tooltip to excel cell data in c#

Could anyone please help me here?

The code should be written in C# and running on .NET.


Solution

  • You can add comments to Excel cells. Checking the following code example:

    using Spire.Xls;
    
    namespace Comment
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Create a Workbook object
                Workbook workbook = new Workbook();
    
                //Load the sample workbook
                workbook.LoadFromFile("Sample.xlsx");
    
                //Get the first worksheet
                Worksheet sheet = workbook.Worksheets[0];
    
                //Add regular comment to specific cell range C6
                CellRange range = sheet.Range["C6"];
                ExcelComment comment = range.AddComment();
                comment.Text = "Regular comment";                      
                
                //Save the Excel workbook.
                workbook.SaveToFile("Addcomment.xlsx", ExcelVersion.Version2016);
            }
        }
    }
    

    https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Add-Comments-in-Excel-and-Set-Comments-Format-with-C-VB.NET.html