Excel.CellPropertiesFont interface

Stellt die format.font Eigenschaften von getCellProperties, getRowPropertiesundgetColumnProperties oder den format.font Eingabeparameter von setCellProperties,setRowProperties und dar.setColumnProperties

Eigenschaften

bold

Stellt die format.font.bold Eigenschaft dar.

color

Stellt die format.font.color Eigenschaft dar.

italic

Stellt die format.font.italic Eigenschaft dar.

name

Stellt die format.font.name Eigenschaft dar.

size

Stellt die format.font.size Eigenschaft dar.

strikethrough

Stellt die format.font.strikethrough Eigenschaft dar.

subscript

Stellt die format.font.subscript Eigenschaft dar.

superscript

Stellt die format.font.superscript Eigenschaft dar.

tintAndShade

Stellt die format.font.tintAndShade Eigenschaft dar.

underline

Stellt die format.font.underline Eigenschaft dar.

Details zur Eigenschaft

bold

Stellt die format.font.bold Eigenschaft dar.

bold?: boolean;

Eigenschaftswert

boolean

Hinweise

API-Satz: ExcelApi 1.9

color

Stellt die format.font.color Eigenschaft dar.

color?: string;

Eigenschaftswert

string

Hinweise

API-Satz: ExcelApi 1.9

Beispiele

// 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();

    // Creating the SettableCellProperties objects to use for the range.
    // In your add-in, these should be created once, outside the function.
    const topHeaderProps: Excel.SettableCellProperties = {
        // The style property takes a string matching the name of an Excel style.
        // Built-in style names are listed in the `BuiltInStyle` enum.
        // Note that a style will overwrite any formatting,
        // so do not use the format property with the style property.
        style: "Heading1"
    };

    const headerProps: Excel.SettableCellProperties = {
        // Any subproperties of format that are not set will not be changed when these cell properties are set.
        format: {
            fill: {
                color: "Blue"
            },
            font: {
                color: "White",
                bold: true
            }
        }
    };

    const nonApplicableProps: Excel.SettableCellProperties = {
        format: {
            fill: {
                pattern: Excel.FillPattern.gray25
            },
            font: {
                color: "Gray",
                italic: true
            }
        }
    };

    const matchupScoreProps: Excel.SettableCellProperties = {
        format: {
            borders: {
                bottom: {
                    style: Excel.BorderLineStyle.continuous
                },
                left: {
                    style: Excel.BorderLineStyle.continuous
                },
                right: {
                    style: Excel.BorderLineStyle.continuous
                },
                top: {
                    style: Excel.BorderLineStyle.continuous
                }
            }
        }
    };

    const range = sheet.getRange("A1:E5");

    // You can use empty JSON objects to avoid changing a cell's properties.
    range.setCellProperties([
        [topHeaderProps, {}, {}, {}, {}],
        [{}, {}, headerProps, headerProps, headerProps],
        [{}, headerProps, nonApplicableProps, matchupScoreProps, matchupScoreProps],
        [{}, headerProps, matchupScoreProps, nonApplicableProps, matchupScoreProps],
        [{}, headerProps, matchupScoreProps, matchupScoreProps, nonApplicableProps]
    ]);

    sheet.getUsedRange().format.autofitColumns();
    await context.sync();
});

italic

Stellt die format.font.italic Eigenschaft dar.

italic?: boolean;

Eigenschaftswert

boolean

Hinweise

API-Satz: ExcelApi 1.9

name

Stellt die format.font.name Eigenschaft dar.

name?: string;

Eigenschaftswert

string

Hinweise

API-Satz: ExcelApi 1.9

size

Stellt die format.font.size Eigenschaft dar.

size?: number;

Eigenschaftswert

number

Hinweise

API-Satz: ExcelApi 1.9

strikethrough

Stellt die format.font.strikethrough Eigenschaft dar.

strikethrough?: boolean;

Eigenschaftswert

boolean

Hinweise

API-Satz: ExcelApi 1.9

subscript

Stellt die format.font.subscript Eigenschaft dar.

subscript?: boolean;

Eigenschaftswert

boolean

Hinweise

API-Satz: ExcelApi 1.9

superscript

Stellt die format.font.superscript Eigenschaft dar.

superscript?: boolean;

Eigenschaftswert

boolean

Hinweise

API-Satz: ExcelApi 1.9

tintAndShade

Stellt die format.font.tintAndShade Eigenschaft dar.

tintAndShade?: number;

Eigenschaftswert

number

Hinweise

API-Satz: ExcelApi 1.9

underline

Stellt die format.font.underline Eigenschaft dar.

underline?: Excel.RangeUnderlineStyle | "None" | "Single" | "Double" | "SingleAccountant" | "DoubleAccountant";

Eigenschaftswert

Excel.RangeUnderlineStyle | "None" | "Single" | "Double" | "SingleAccountant" | "DoubleAccountant"

Hinweise

API-Satz: ExcelApi 1.9