XlsFile.NearestColorIndex Method
Overloads
XlsFile.NearestColorIndex(TUIColor)
Returns the most similar entry on the excel palette for a given color.
Syntax
Namespace: FlexCel.XlsAdapter
public override Int32 NearestColorIndex(TUIColor value)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
value | TUIColor | Color we want to use. |
Returns
Most similar color on the Excel palette.
See also
XlsFile.NearestColorIndex(TUIColor, Boolean[])
IMPORTANT: Since FlexCel 5.1, using ExcelFile.OptimizeColorPalette before saving should normally be used instead of this method to get an optimized palette. Just enter the true colors in FlexCel, and call ExcelFile.OptimizeColorPalette before saving.
Returns the most similar entry on the excel palette for a given color. If UsedColors is not null, it will try to modify the Excel color palette to get a better match on the color, modifying among the not used colors. Note that modifying the standard palette might result on a file that is not easy to edit on Excel later, since it does not have the standard Excel colors.
Syntax
Namespace: FlexCel.XlsAdapter
public override Int32 NearestColorIndex(TUIColor value, Boolean[] UsedColors)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
value | TUIColor | Color we want to use. | |
UsedColors | Boolean[] | If null, this behaves like the standard NearestColorIndex. To get a list of used colors for the first call, use ExcelFile.GetUsedPaletteColors. After the first call, keep using the same UsedColors structure and do not call GetUsedPaletteColors again, to avoid overwriting colors that are not yet inserted into the xls file with new ones. You can call GetUsedPaletteColors only after you added the format with ExcelFile.AddFormat |
Returns
Most similar color on the Excel palette.