Table of Contents

ExcelFile.MeasureString Method

Returns the size of a TRichString in points.

Syntax

Namespace: FlexCel.Core

public abstract TUISize MeasureString(TRichString text, TFlxFont cellFont)

Parameters

<-> Parameter Type Description
text TRichString Rich string to measure.
cellFont TFlxFont Font of the cell itself. This font might change later in the string.

Returns

The size in points

Examples

To measure the text in cell 1, 1, you can use the code:

    static void MeasureStringExample()
    {
        XlsFile xls = new XlsFile("SomeFile.xlsx", true);
        const int row = 1;
        const int col = 1;
        var size = xls.MeasureString(xls.GetStringFromCell(row, col), xls.GetCellVisibleFormatDef(row, col).Font);
    }

See also