Hi,
Hi,
For finding and searching data, please see Find or Search Data
For applying style and format range, please see Copy Range Data with Style and more complete example Format Worksheet Cells in a Workbook
Hi,
Can i find cells with specified format, for example cells with blue background color?
Hi,
Yes, you can do it, you will have to check the background color of all the cells and find them out.
For example int this following code. It will change the font color by iterating all cells.
You can download the source file and the output file generated by this code.
Please see the screenshot for more illustration
C#
string filePath = @“F:\source.xlsx”;
//Load a source workbook
Workbook wb = new Workbook(filePath);
//Iterate all worksheets
for (int i = 0; i < wb.Worksheets.Count; i++)
{
Cells cells = wb.Worksheets[i].Cells;
//Set the font color of all the cells to black which has blue font color
for (IEnumerator ie = cells.GetEnumerator(); ie.MoveNext(); )
{
Cell cell = (Cell)ie.Current;
Style style = cell.GetStyle();
int rgb = style.Font.Color.ToArgb() & 0xFFFFFF;
if (rgb == (Color.Blue.ToArgb() & 0xFFFFFF))
{
style.Font.Color = Color.Black;
cell.SetStyle(style);
}//if
}//for
}//for
//Save the worbook
wb.Save(filePath + “.out.xlsx”);