Excel.RangeTextRun interface
Represents a sequence of one or more characters that share the same font attributes in a cell. Can be used as the textRuns properties of getCellProperties or the textRuns input parameter of setCellProperties.
Remarks
Used by
Examples
// 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();
});
Properties
| font | The font attributes (such as font name, font size, and color) applied to this text run. |
| text | The text of this text run. |
Property Details
font
The font attributes (such as font name, font size, and color) applied to this text run.
font?: Excel.CellPropertiesFont;