I am currently upgrading our solution to use Aspose.Cells 21.6 and the following code has stopped working from the previous version of Aspose.Cells.
public void SetCellColor(int row, int col, Color color)
{
Cell cell = this.Worksheet.Cells[row, col];
Style cellStyle = cell.GetStyle();
cellStyle.ForegroundColor = color;
cellStyle.Pattern = BackgroundType.Solid;
cell.SetStyle(cellStyle);
}
The problem is that the variable color is “{Name=eedf1e, ARGB=(0, 238, 223, 30)}”
After cellStyle.ForegroundColor = color; executes cellStyle.ForegroundColor is “{Name=ffeedf1e, ARGB=(255, 238, 223, 30)}”
The A is 255 instead of 0!
I have tried cellStyle.Pattern = BackgroundType.Solid; before setting the ForegroundColor.
I have tried this code
cellStyle.ForegroundColor = Color.FromArgb(color.A, color.R, color.G, color.B);
But the A still gets set to 255 instead of 0.
The IsKnownColor of both is false.
I have tried adding the color to the palette:
workbook.ChangePalette(Color.FromArgb(ADDED_CELL_COLOR), 55);
How do I set the color that has been provided with confidence that the A, R, G and B are correct?