PowerPoint.TextRun interface

表示具有相同字体属性的一个或多个字符的序列。

注解

[ API 集:PowerPointApi 1.8 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml

// Specifies the text runs of the cells in a table.
await PowerPoint.run(async (context) => {
  const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;

  // Add a table, specifying text runs.
  shapes.addTable(3, 4, {
    specificCellProperties: [
      [
        { text: "Title text", font: { bold: true } },
        { text: "Title text", font: { bold: true } },
        { text: "Title text", font: { bold: true } },
        { text: "Title text", font: { bold: true } }
      ],
      [
        { text: "Bold text", font: { bold: true } },
        {
          textRuns: [
            { text: "Text runs with " },
            { text: "Underlined text", font: { underline: PowerPoint.ShapeFontUnderlineStyle.double } },
            { text: " and plain text" }
          ]
        },
        { text: "Italicized text", font: { italic: true } },
        { text: "Plain text" }
      ],
      [
        { text: "Bold text", font: { bold: true } },
        { text: "Underlined text", font: { underline: PowerPoint.ShapeFontUnderlineStyle.dotted } },
        {
          font: { bold: true },
          textRuns: [
            { text: "Text runs with " },
            { text: "italicized text", font: { italic: true } },
            { text: " and (inherited) bold text" }
          ]
        },
        { text: "Italicized text", font: { italic: true } }
      ]
    ]
  });
  await context.sync();
});

属性

font

字体属性 (,如字体名称、字号和颜色) 应用于此文本运行。

text

此文本的文本运行。

属性详细信息

font

字体属性 (,如字体名称、字号和颜色) 应用于此文本运行。

font?: PowerPoint.FontProperties;

属性值

注解

[ API 集:PowerPointApi 1.8 ]

text

此文本的文本运行。

text: string;

属性值

string

注解

[ API 集:PowerPointApi 1.8 ]