Word.InsertShapeOptions interface
指定用于在插入形状时确定位置和大小的选项。
注解
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/45-shapes/manage-shapes-text-boxes.yaml
await Word.run(async (context) => {
// Inserts a text box at the beginning of the selection.
const range: Word.Range = context.document.getSelection();
const insertShapeOptions: Word.InsertShapeOptions = {
top: 0,
left: 0,
height: 100,
width: 100
};
const newTextBox: Word.Shape = range.insertTextBox("placeholder text", insertShapeOptions);
await context.sync();
console.log("Inserted a text box at the beginning of the current selection.");
});
属性
| height | 如果提供,则指定要插入的形状的高度。 |
| left | 如果已提供,则指定要插入的形状的左侧位置。 |
| top | 如果提供,则指定要插入的形状的顶部位置。 |
| width | 如果提供,则指定要插入的形状的宽度。 |