Highlight word in aspose.cells


I am searching for a word and if it is found, I wanted to get that word highlighted in aspose.cells.

Now what happens is the entire cell is getting highlighted if the word is found.
I wanted to highlight only the word.

                Worksheet sheet = wb.Worksheets[i];
                Cells cells = sheet.Cells;
                //arranges row and column according to text in cell
                sheet.AutoFitColumns(); sheet.AutoFitRows();
                HtmlSaveOptions options = new HtmlSaveOptions();
                //word to search
                //foreach (var word in words)
                FindOptions findOptions = new FindOptions();
                findOptions.CaseSensitive = false;
                findOptions.LookInType = LookInType.Values;
                findOptions.LookAtType = LookAtType.Contains;
                Cell nextCell = null;
                    nextCell = cells.Find(words[0], nextCell, findOptions);
                    if (nextCell == null)
                        //string text = nextCell.Value.ToString();

                        //Set the background color of that cell to highlight it.
                        Aspose.Cells.Style style = nextCell.GetStyle();
                        style.ForegroundColor = System.Drawing.Color.Yellow;
                        style.Pattern = Aspose.Cells.BackgroundType.Solid;
                        style.Font.Color = Color.Black;

                        options.ExportImagesAsBase64 = true;
                        // Convert all worksheets to html one by one by setting it as active
                        wb.Worksheets.ActiveSheetIndex = i;
                        //used to make document into single html file
                        options.ExportActiveWorksheetOnly = true;

                        options.ExportGridLines = true;

                } while (true);

sharing my code as well. image.zip (14.9 KB)


Please note, in MS Excel, you cannot change the shading/background color for a specific word/chars in the cell as fill/background color is applied to whole cell and not a part of it. If you want you can change the font color for your specific text in the cell, see the document on formatting selected chars in a cell for your reference.

If you still think highlighting/applying background color to specific string/text/word in a cell is possible in MS Excel manually, kindly do share a sample file (please zip the file prior attaching) containing highlighted (background) color for a part of the data in the cell, we will check on how to do it via Aspose.Cells APIs.