Word.RelativeSize enum
Représente la taille horizontale ou verticale d’une forme par rapport à . Pour plus d’informations sur les marges, consultez Modifier les marges dans votre document Word.
Remarques
[ Ensemble d’API : WordApiDesktop 1.2 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/45-shapes/group-ungroup.yaml
await Word.run(async (context) => {
// Changes the relative size of the first set of grouped shapes (including text boxes) found in the document body.
const firstShapeGroup: Word.Shape = context.document.body.shapes
.getByTypes([Word.ShapeType.group])
.getFirstOrNullObject();
firstShapeGroup.load("shapeGroup/shapes");
await context.sync();
if (firstShapeGroup.isNullObject) {
console.log("No shape groups found in the document body.");
return;
}
let shapeGroup: Word.ShapeGroup = firstShapeGroup.shapeGroup;
console.log(
"About to change the relative size of the first shape group found in the document body:",
shapeGroup.shapes,
);
firstShapeGroup.relativeHorizontalSize = Word.RelativeSize.insideMargin;
firstShapeGroup.relativeVerticalSize = Word.RelativeSize.bottomMargin;
firstShapeGroup.heightRelative = 50;
console.log("Changed the relative size of the first shape group.");
});
Champs
| bottomMargin = "BottomMargin" | Marge inférieure. |
| insideMargin = "InsideMargin" | Par rapport à la marge intérieure. |
| margin = "Margin" | Marge. |
| outsideMargin = "OutsideMargin" | Par rapport à la marge externe. |
| page = "Page" | Page. |
| topMargin = "TopMargin" | Marge supérieure. |