Search Results for

    Show / Hide Table of Contents

    TExcelFile.NearestColorIndex Method

    Overloads

    • TExcelFile.NearestColorIndex(TUIColor)
    • TExcelFile.NearestColorIndex(TUIColor, BooleanArray)

    TExcelFile.NearestColorIndex(TUIColor)

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

    Syntax

    Unit: FlexCel.Core

    function TExcelFile.NearestColorIndex(const value: TUIColor): Integer; overload; virtual; abstract;

    Parameters

    <-> Parameter Type Description
    const value TUIColor Color we want to use.

    Returns

    Most similar color on the Excel palette.

    See also

    • TExcelFile

    TExcelFile.NearestColorIndex(TUIColor, BooleanArray)

    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

    Unit: FlexCel.Core

    function TExcelFile.NearestColorIndex(const value: TUIColor; const UsedColors: TArray<Boolean>): Integer; overload; virtual; abstract;

    Parameters

    <-> Parameter Type Description
    const value TUIColor Color we want to use.
    const UsedColors TArray<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

    • TExcelFile
    In This Article
    Back to top FlexCel Studio for VCL and FireMonkey v7.24
    © 2002 - 2025 tmssoftware.com