PowerPoint.FontProperties interface
Represents the font attributes, such as font name, size, and color.
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
Properties
all |
Represents whether the font uses all caps, where lowercase letters are shown as capital letters. |
bold | Represents the bold status of font. |
color | Represents the HTML color in the hexadecimal format (e.g., "#FF0000" represents red) or as a named HTML color value (e.g., "red"). |
double |
Represents the double-strikethrough status of the font. |
italic | Represents the italic status of font. |
name | Represents the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name. |
size | Represents the font size in points (e.g., 11). |
small |
Represents whether the text uses small caps, where lowercase letters are shown as small capital letters. |
strikethrough | Represents the strikethrough status of the font. |
subscript | Represents the subscript status of the font. |
superscript | Represents the superscript status of the font. |
underline | Type of underline applied to the font. See PowerPoint.ShapeFontUnderlineStyle for details. |
Property Details
allCaps
Represents whether the font uses all caps, where lowercase letters are shown as capital letters.
allCaps?: boolean | undefined;
Property Value
boolean | undefined
Remarks
bold
Represents the bold status of font.
bold?: boolean | undefined;
Property Value
boolean | undefined
Remarks
color
Represents the HTML color in the hexadecimal format (e.g., "#FF0000" represents red) or as a named HTML color value (e.g., "red").
color?: string | undefined;
Property Value
string | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
doubleStrikethrough
Represents the double-strikethrough status of the font.
doubleStrikethrough?: boolean | undefined;
Property Value
boolean | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
italic
Represents the italic status of font.
italic?: boolean | undefined;
Property Value
boolean | undefined
Remarks
name
Represents the font name (e.g., "Calibri"). If the text is a Complex Script or East Asian language, this is the corresponding font name; otherwise it's the Latin font name.
name?: string | undefined;
Property Value
string | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
size
Represents the font size in points (e.g., 11).
size?: number | undefined;
Property Value
number | undefined
Remarks
smallCaps
Represents whether the text uses small caps, where lowercase letters are shown as small capital letters.
smallCaps?: boolean | undefined;
Property Value
boolean | undefined
Remarks
strikethrough
Represents the strikethrough status of the font.
strikethrough?: boolean | undefined;
Property Value
boolean | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
subscript
Represents the subscript status of the font.
subscript?: boolean | undefined;
Property Value
boolean | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
superscript
Represents the superscript status of the font.
superscript?: boolean | undefined;
Property Value
boolean | undefined
Remarks
[ API set: PowerPointApi 1.8 ]
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Specifies the font formatting and fill colors of the cells in a table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a table, specifying font formatting and fill colors
shapes.addTable(3, 4, {
values: [
["A", "BB", "CCC", "DDDD"],
["E", "FF", "GGG", "HHHH"],
["1", "12", "123", "1234"]
],
specificCellProperties: [
[
{ fill: { color: "red" }, font: { color: "yellow", name: "Calibri" } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", name: "Coolvetica" } },
{ fill: { color: "red" }, font: { color: "yellow", italic: true } },
{ fill: { color: "red" }, font: { color: "#9966cc", strikethrough: true } }
],
[
{ fill: { color: "#fbceb1" }, font: { color: "yellow", doubleStrikethrough: true } },
{ fill: { color: "red" }, font: { color: "yellow", subscript: true } },
{ fill: { color: "#0048ba" }, font: { color: "yellow", superscript: true } },
{ fill: { color: "red" }, font: { color: "yellow" } }
],
[
{ fill: { color: "red" }, font: { color: "#b0bf1a" } },
{ fill: { color: "#9966cc" }, font: { color: "yellow" } },
{ fill: { color: "#b0bf1a" }, font: { color: "yellow" } },
{ fill: { color: "red" }, font: { color: "#fbceb1" } }
]
]
});
await context.sync();
});
underline
Type of underline applied to the font. See PowerPoint.ShapeFontUnderlineStyle for details.
underline?: PowerPoint.ShapeFontUnderlineStyle | "None" | "Single" | "Double" | "Heavy" | "Dotted" | "DottedHeavy" | "Dash" | "DashHeavy" | "DashLong" | "DashLongHeavy" | "DotDash" | "DotDashHeavy" | "DotDotDash" | "DotDotDashHeavy" | "Wavy" | "WavyHeavy" | "WavyDouble" | undefined;
Property Value
PowerPoint.ShapeFontUnderlineStyle | "None" | "Single" | "Double" | "Heavy" | "Dotted" | "DottedHeavy" | "Dash" | "DashHeavy" | "DashLong" | "DashLongHeavy" | "DotDash" | "DotDashHeavy" | "DotDotDash" | "DotDotDashHeavy" | "Wavy" | "WavyHeavy" | "WavyDouble" | undefined