SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface IStyle

    The IStyle interface combines user-applied styles with dynamic styles, such as those from tables or conditional formatting, to deliver the current appearance.

    interface IStyle {
        isIStyle: true;
        clear(): IStyle;
        createStyle(update: IStyle.Update): IStyle;
        createTextFrame(text: string, allowWrap?: boolean): ITextFrame;
        getAlignment(): ITextBoxAlignment;
        getBestFit(): Partial<Size> | null;
        getBorders(): IBorders;
        getFill(): IGradient | INone | ISolid | IPattern;
        getFont(): IStyledFont;
        getInsets(): Rectangle;
        getNamed(): IStyle.INamed;
        getNumberFormat(): string;
        getProtection(): ICellProtection;
        getQuotePrefix(): boolean;
        hasVisibleStyling(): boolean;
        isNormal(): boolean;
        measureText(
            text: string,
            size?: number,
            family?: string,
            options?: MetricOptions,
        ): ExtendedMetrics;
        setAlignment(
            alignment: ITextBoxAlignment.Update,
            options?: UpdateOptions,
        ): IStyle;
        setBorders(borders: IBorders.Update, options?: UpdateOptions): IStyle;
        setFill(fill: IFill.Update, options?: UpdateOptions): IStyle;
        setFillGradient(options?: UpdateOptions): IGradient;
        setFillNone(options?: UpdateOptions): INone;
        setFillPattern(options?: UpdateOptions): IPattern;
        setFillSolid(options?: UpdateOptions): ISolid;
        setFont(font: IStyledFont.Update, options?: UpdateOptions): IStyle;
        setNamed(
            named: string | IStyle.INamed | null,
            options?: UpdateOptions,
        ): IStyle;
        setNumberFormat(numFmt: string | null, options?: UpdateOptions): IStyle;
        setProtection(
            protection: ICellProtection.Update,
            options?: UpdateOptions,
        ): IStyle;
        setQuotePrefix(
            quotePrefix: boolean | null,
            options?: UpdateOptions,
        ): IStyle;
        toJSON(): IStyle.JSON | null;
        update(update: IStyle.Update, options?: UpdateOptions): IStyle;
    }
    Index
    isIStyle: true

    For runtime type checking.

    • Clears all styling properties, resetting to default.

      Returns IStyle

      a reference to a normal style.

    • Allows for a non managed style. Useful for tooltips or other transient styles.

      Parameters

      Returns IStyle

    • Creates a simple text frame that can be used for rendering and/or measuring.

      Parameters

      • text: string
      • OptionalallowWrap: boolean

        If true then will try to wrap on natural breaks.

      Returns ITextFrame

    • Returns the best fit size assuming no content.

      Returns Partial<Size> | null

    • Returns insets used for content. This does not taking into account indent because this is alignment and type specific.

      Returns Rectangle

    • Returns the protection format: whether the cell stays editable, and whether it shows its formula, while its sheet is protected.

      Returns ICellProtection

    • A boolean value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). In these cases, the quote is not stored in the Shared Strings Part.

      Returns boolean

    • This is used to determine if the style has rendering artifacts even if there is no content. (For example borders or background)

      Returns boolean

    • Returns true if the CellStyle is the normal style

      Returns boolean

    • Measure the text using the styling properties

      Parameters

      • text: string

        The text to measure.

      • Optionalsize: number

        Size

      • Optionalfamily: string

        Family

      • Optionaloptions: MetricOptions

        Options for the measurement.

      Returns ExtendedMetrics

      'to the cell font.size'
      
      'to the cell font.family'
      
    • Sets the borders.

      This method allows updating borders using an IBorders or a shorthand property object.

      Parameters

      • borders: IBorders.Update

        The borders object or a shorthand property object to apply. Pass null to clear.

      • Optionaloptions: UpdateOptions

        Optional configuration for the update.

      Returns IStyle

      The IBorders object for further modifications.

    • Sets the fill style.

      This method allows updating fill using an IFill or a shorthand property object.

      Parameters

      • fill: IFill.Update

        The fill object or a shorthand property object to apply. Pass null to clear.

      • Optionaloptions: UpdateOptions

        Optional configuration for the update.

      Returns IStyle

      The IFill object for further modifications.

    • Sets the font style.

      This method allows updating fill using an IStyledFont or a shorthand property object.

      Parameters

      • font: IStyledFont.Update

        The font object or a shorthand property object to apply. Pass null to clear.

      • Optionaloptions: UpdateOptions

        Optional configuration for the update.

      Returns IStyle

      The IStyledFont object for further modifications.

    • Returns a JSON representation of the style.

      Returns IStyle.JSON | null