modern-xlsx API Reference - v1.3.0
    Preparing search index...

    Class RichTextBuilder

    Fluent builder for constructing rich text runs with mixed formatting.

    Each method appends a styled text segment and returns this for chaining. Call build to get a frozen readonly RichTextRun[].

    const runs = new RichTextBuilder()
    .text('Hello ')
    .bold('World')
    .colored('!', 'FF0000')
    .build();
    ws.cell('A1').richText = runs;
    Index
    • Add text with custom styling options.

      Parameters

      • str: string

        The text content.

      • opts: {
            bold?: boolean;
            color?: string;
            fontName?: string;
            fontSize?: number;
            italic?: boolean;
            strike?: boolean;
            underline?: boolean;
        }

        Formatting options (bold, italic, underline, strike, fontName, fontSize, color).

      Returns this

      this for chaining.

      builder.styled('Custom', { fontName: 'Courier', fontSize: 16, color: '0000FF' });