Search Results for

    Show / Hide Table of Contents

    TExcelFile.SetCellFormat Method

    Overloads

    • TExcelFile.SetCellFormat(Integer, Integer, Integer)
    • TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, Integer)
    • TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, TFlxFormat, TFlxApplyFormat)
    • TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, TFlxFormat, TFlxApplyFormat, Boolean)

    TExcelFile.SetCellFormat(Integer, Integer, Integer)

    Sets the Cell format (XF) on a given cell. You can create new formats using the AddFormat function.

    Syntax

    Unit: FlexCel.Core

    procedure TExcelFile.SetCellFormat(const row: Integer; const col: Integer; const XF: Integer); overload; virtual; abstract;

    Parameters

    <-> Parameter Type Description
    const row Integer Row index of the cell (1 based)
    const col Integer Column index of the cell (1 based)
    const XF Integer XF Format index. See 'Cell formats' in the Api Developer Guide.

    See also

    • TExcelFile
    • GetCellFormat(Integer, Integer)
    • AddFormat

    TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, Integer)

    Sets the Cell format (XF) on a range of cells. You can create new formats using the AddFormat function.

    Syntax

    Unit: FlexCel.Core

    procedure TExcelFile.SetCellFormat(const row1: Integer; const col1: Integer; const row2: Integer; const col2: Integer; const XF: Integer); overload; virtual; abstract;

    Parameters

    <-> Parameter Type Description
    const row1 Integer Row index of the top cell on the range (1 based)
    const col1 Integer Column index of the left cell on the range (1 based)
    const row2 Integer Row index of the bottom cell on the range (1 based)
    const col2 Integer Column index of the right cell on the range (1 based)
    const XF Integer XF Format index. See 'Cell formats' in the Api Developer Guide.

    See also

    • TExcelFile
    • GetCellFormat(Integer, Integer)
    • AddFormat

    TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, TFlxFormat, TFlxApplyFormat)

    Changes part of the Cell format on a range of cells. WARNING! This method is slower than the other SetCellFormat versions, use it only if you do not care about maximum performance or if you just can't use the other SetCellFormat versions. This particular version of SetCellFormat has to read the format on each cell, modify it and write it back. While still very fast, it is not as fast as just setting the format on a cell.

    Remarks

    You can use this method for example to add a border on the top of a row of cells, keeping the existing font and pattern styles on the range.

    Syntax

    Unit: FlexCel.Core

    procedure TExcelFile.SetCellFormat(const row1: Integer; const col1: Integer; const row2: Integer; const col2: Integer; const newFormat: TFlxFormat; const applyNewFormat: TFlxApplyFormat); overload;

    Parameters

    <-> Parameter Type Description
    const row1 Integer Row index of the top cell on the range (1 based)
    const col1 Integer Column index of the left cell on the range (1 based)
    const row2 Integer Row index of the bottom cell on the range (1 based)
    const col2 Integer Column index of the right cell on the range (1 based)
    const newFormat TFlxFormat Format to apply to the cells.
    const applyNewFormat TFlxApplyFormat Indicates which properties of newFormat will be applied to the cells.

    See also

    • TExcelFile

    TExcelFile.SetCellFormat(Integer, Integer, Integer, Integer, TFlxFormat, TFlxApplyFormat, Boolean)

    Changes part of the Cell format on a range of cells. WARNING! This method is slower than the other SetCellFormat versions, use it only if you do not care about maximum performance or if you just can't use the other SetCellFormat versions. This particular version of SetCellFormat has to read the format on each cell, modify it and write it back. While still very fast, it is not as fast as just setting the format on a cell.

    Remarks

    You can use this method for example to add a border on the top of a row of cells, keeping the existing font and pattern styles on the range.

    Syntax

    Unit: FlexCel.Core

    procedure TExcelFile.SetCellFormat(const row1: Integer; const col1: Integer; const row2: Integer; const col2: Integer; const newFormat: TFlxFormat; const applyNewFormat: TFlxApplyFormat; const exteriorBorders: Boolean); overload; virtual; abstract;

    Parameters

    <-> Parameter Type Description
    const row1 Integer Row index of the top cell on the range (1 based)
    const col1 Integer Column index of the left cell on the range (1 based)
    const row2 Integer Row index of the bottom cell on the range (1 based)
    const col2 Integer Column index of the right cell on the range (1 based)
    const newFormat TFlxFormat Format to apply to the cells.
    const applyNewFormat TFlxApplyFormat Indicates which properties of newFormat will be applied to the cells.
    const exteriorBorders Boolean When true, the format for the border will be applied only to the outer cells in the range. This can be useful for example to draw a box around a range of cells, but not drawing borders inside the range.
    Other parameters, like the cell background, will still be applied to the full range.

    See also

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