Search Results for

    Show / Hide Table of Contents

    ExcelFile.NearestColorIndex Method

    Overloads

    • ExcelFile.NearestColorIndex(TUIColor)
    • ExcelFile.NearestColorIndex(TUIColor, Boolean[])

    ExcelFile.NearestColorIndex(TUIColor)

    Returns the most similar entry on the excel palette for a given color.

    Syntax

    Namespace: FlexCel.Core

    public abstract 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

    • ExcelFile

    ExcelFile.NearestColorIndex(TUIColor, Boolean[])

    IMPORTANT: Since FlexCel 5.1, using 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 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.Core

    public abstract 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 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 AddFormat

    Returns

    Most similar color on the Excel palette.

    See also

    • ExcelFile
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com