Word.InsertShapeOptions interface
指定用于在插入形状时确定位置和大小的选项。
注解
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/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.");
});