Hai,
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;
do
{
nextCell = cells.Find(words[0], nextCell, findOptions);
if (nextCell == null)
{
break;
}
else
{
//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;
nextCell.SetStyle(style);
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)