Excel.RangeTextRun interface

セル内で同じフォント属性を共有する 1 つ以上の文字のシーケンスを表します。 getCellPropertiestextRunsプロパティ、または setCellPropertiestextRuns入力パラメーターとして使用できます。

注釈

API セット: ExcelApi 1.18

使用元

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/42-range/cell-properties.yaml

await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getActiveWorksheet();

    const textRunFormats: Excel.RangeTextRun[] = [
        {
            text: "Rich ",
            font: {
                bold: true,
                color: "#C00000",
                size: 14
            }
        },
        {
            text: "text",
            font: {
                color: "#4472C4",
                italic: true,
                underline: Excel.RangeUnderlineStyle.single
            }
        }
    ]
    const richTextProps: Excel.SettableCellProperties = {
        textRuns: textRunFormats
    };

    sheet.getRange("A7").setCellProperties([[richTextProps]]);
    await context.sync();
});

プロパティ

font

このテキスト実行に適用されるフォント属性 (フォント名、フォント サイズ、色など)。

text

このテキスト実行のテキスト。

プロパティの詳細

font

このテキスト実行に適用されるフォント属性 (フォント名、フォント サイズ、色など)。

font?: Excel.CellPropertiesFont;

プロパティ値

注釈

API セット: ExcelApi 1.18

text

このテキスト実行のテキスト。

text: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.18