メインコンテンツまでスキップ

Show.Group

Show.Group は Presentation モジュール(Office.show(iframe))のオブジェクト型です。メソッド 34 個。

備考​

  • モジュール: Presentation · Office.show(iframe) · 名前空間 Show
  • 取得方法: Slide.groupShapes(shapeProxyList)
  • すべてのメソッドは Promise を返し、シグネチャは TypeScript 表記です。

メソッド​

メソッド説明
align(alignType)図形をスライド基準で配置します。
flip(direction)図形を上下または左右に反転します。
getChildren()グループの子図形の一覧を返します。
getHeight()図形の高さを返します。
getPlaceholderType()図形の placeholder の種類を返します。
getPresetId()図形の OOXML preset id(prst)を返します。
getRotation()図形の回転角度を返します。
getTransform()図形の位置、サイズ、回転の情報を返します。
getWidth()図形の幅を返します。
getX()図形の X 座標を返します。
getY()図形の Y 座標を返します。
getZOrderIndex()親(スライド、グループの子であればそのグループ)内での図形の z-order 順位を返します。
hasText()図形がテキストを含んでいるかどうかを返します。
isChart()Checks whether this handle is of type Chart (type guard for narrowing the union).
isControl()Checks whether this handle is of type Control (type guard for narrowing the union).
isDiagram()Checks whether this handle is of type Diagram (type guard for narrowing the union).
isFlippedH()図形が左右に反転した状態かどうかを返します。
isFlippedV()図形が上下に反転した状態かどうかを返します。
isGroup()Checks whether this handle is of type Group (type guard for narrowing the union).
isImage()Checks whether this handle is of type Image (type guard for narrowing the union).
isLine()Checks whether this handle is of type Line (type guard for narrowing the union).
isOleObject()Checks whether this handle is of type OleObject (type guard for narrowing the union).
isPlaceholder()図形が placeholder(タイトル · 本文の枠など)かどうかを返します。
isShape()Checks whether this handle is of type Shape (type guard for narrowing the union).
isTable()Checks whether this handle is of type Table (type guard for narrowing the union).
moveBy(distance)図形を現在の位置を基準に x、y だけ相対移動します。
reorder(order)図形の重なり順(前面へ/背面へ)を変更します。
setHeight(height)図形の高さを設定します。
setRotation(rotation)図形の回転角度を絶対値で設定します。
setTransform(transform)図形の位置・サイズ・回転を一度に設定します。
setWidth(width)図形の幅を設定します。
setX(x)図形の X 座標を絶対値で設定します。
setY(y)図形の Y 座標を絶対値で設定します。
ungroup()グループを解除して、子図形をスライドの最上位に分離します。

メソッドの詳細​

align(alignType)​

図形をスライド基準で配置します。移動できない図形の場合は無視されます。グループの子も、グループ内ではなくスライドを基準に移動します。子がグループの外に出ると、グループは子を含むように一緒に広がります。

align(alignType: AlignType): Promise<void>;

パラメーター

名前型説明
alignTypeAlignType配置の種類

戻り値

none

flip(direction)​

図形を上下または左右に反転します。現在の反転状態を切り替えるトグルで、現在反転しているかどうかは isFlippedH()/isFlippedV() で読み取ります。回転できない図形では反転も無視されます。回転した図形は角度も鏡像として一緒に変わります(getRotation() の値が 360 - 元の角度 に変わります)。

flip(direction: FlipDirection): Promise<void>;

パラメーター

名前型説明
directionFlipDirection反転方向

戻り値

none

getChildren()​

グループの子図形の一覧を返します。

getChildren(): Promise<Shape[]>;

戻り値

Promise<Shape[]> - 子図形の一覧。グループ図形がない場合(共同編集中の削除など)は空の配列

getHeight()​

図形の高さを返します。(setHeight と対称)

getHeight(): Promise<number | null>;

戻り値

Promise<number | null> - 高さ(px 単位)。対象の図形がない場合は null

getPlaceholderType()​

図形の placeholder の種類を返します。

getPlaceholderType(): Promise<PlaceholderType | null>;

戻り値

Promise<PlaceholderType | null> - placeholder の種類。placeholder でない場合、または対象の図形がない場合は null

getPresetId()​

図形の OOXML preset id(prst)を返します。

getPresetId(): Promise<string | null>;

戻り値

Promise<string | null> - preset id(prst)。ない場合は null

getRotation()​

図形の回転角度を返します。(setRotation と対称)

getRotation(): Promise<number | null>;

戻り値

Promise<number | null> - 回転角度(degree)。対象の図形がない場合は null

getTransform()​

図形の位置、サイズ、回転の情報を返します。x/y は反転(flip)の有無にかかわらず図形の左上なので、戻り値を別の図形の setTransform にそのまま渡すと、2 つの図形が同じ位置に配置されます。値は丸めて返されます - サイズは小数第 1 位、位置は整数です。setter も同じ単位で受け取るため、インポートしたドキュメントのようにより細かく配置された図形は、渡し直すとその分だけ移動します。

getTransform(): Promise<ShapeTransform | null>;

戻り値

Promise<ShapeTransform | null> - 図形の位置・サイズ・回転の情報。対象の図形がない場合(共同編集中の削除など)は null

getWidth()​

図形の幅を返します。(setWidth と対称)

getWidth(): Promise<number | null>;

戻り値

Promise<number | null> - 幅(px 単位)。対象の図形がない場合は null

getX()​

図形の X 座標を返します。(setX と対称)

getX(): Promise<number | null>;

戻り値

Promise<number | null> - X 座標(px 単位)。対象の図形がない場合は null

getY()​

図形の Y 座標を返します。(setY と対称)

getY(): Promise<number | null>;

戻り値

Promise<number | null> - Y 座標(px 単位)。対象の図形がない場合は null

getZOrderIndex()​

親(スライド、グループの子であればそのグループ)内での図形の z-order 順位を返します。0 が最背面で、大きいほど前面です。

getZOrderIndex(): Promise<number | null>;

戻り値

Promise<number | null> - z-order 順位。対象の図形がない場合は null

hasText()​

図形がテキストを含んでいるかどうかを返します。空白のみの場合や空の段落が 2 つ以上ある場合(改行のみを入力した状態)は true、空の段落が 1 つだけの場合は false です。図形レベルのテキストを持たない種類(表・グループ・グラフ)は常に false です。(表はセル単位で照会)

hasText(): Promise<boolean | null>;

戻り値

Promise<boolean | null> - テキストの有無。対象の図形がない場合は null

isChart()​

Checks whether this handle is of type Chart (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isChart(): Promise<this is Chart>;

戻り値

Promise<this is Chart>

isControl()​

Checks whether this handle is of type Control (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isControl(): Promise<this is Control>;

戻り値

Promise<this is Control>

isDiagram()​

Checks whether this handle is of type Diagram (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isDiagram(): Promise<this is Diagram>;

戻り値

Promise<this is Diagram>

isFlippedH()​

図形が左右に反転した状態かどうかを返します。(flip(FlipDirection.HORIZONTAL) を呼び出すとこの値が反転します)

isFlippedH(): Promise<boolean | null>;

戻り値

Promise<boolean | null> - 左右反転の有無。対象の図形がない場合は null

isFlippedV()​

図形が上下に反転した状態かどうかを返します。(flip(FlipDirection.VERTICAL) を呼び出すとこの値が反転します)

isFlippedV(): Promise<boolean | null>;

戻り値

Promise<boolean | null> - 上下反転の有無。対象の図形がない場合は null

isGroup()​

Checks whether this handle is of type Group (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isGroup(): Promise<this is Group>;

戻り値

Promise<this is Group>

isImage()​

Checks whether this handle is of type Image (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isImage(): Promise<this is Image>;

戻り値

Promise<this is Image>

isLine()​

Checks whether this handle is of type Line (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isLine(): Promise<this is Line>;

戻り値

Promise<this is Line>

isOleObject()​

Checks whether this handle is of type OleObject (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isOleObject(): Promise<this is OleObject>;

戻り値

Promise<this is OleObject>

isPlaceholder()​

図形が placeholder(タイトル · 本文の枠など)かどうかを返します。

isPlaceholder(): Promise<boolean | null>;

戻り値

Promise<boolean | null> - placeholder かどうか。対象の図形がない場合は null

isShape()​

Checks whether this handle is of type Shape (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isShape(): Promise<this is Shape>;

戻り値

Promise<this is Shape>

isTable()​

Checks whether this handle is of type Table (type guard for narrowing the union). Checks the SDK handle's internal discriminator synchronously - no postMessage round trip, no await needed.

isTable(): Promise<this is Table>;

戻り値

Promise<this is Table>

moveBy(distance)​

図形を現在の位置を基準に x、y だけ相対移動します。(絶対座標の設定は setX / setY)

moveBy(distance: ShapeMoveDistance): Promise<void>;

パラメーター

名前型説明
distanceShapeMoveDistance移動量(px 単位)

戻り値

none

reorder(order)​

図形の重なり順(前面へ/背面へ)を変更します。すでに目標の位置にあり変更がない場合は無視されます。

reorder(order: ShapeZOrder): Promise<void>;

パラメーター

名前型説明
orderShapeZOrder順序変更の種類

戻り値

none

setHeight(height)​

図形の高さを設定します。サイズを変更できない図形の場合は無視されます。

setHeight(height: number): Promise<void>;

パラメーター

名前型説明
heightnumber高さ(px 単位、小数第 1 位に丸め)

戻り値

none

setRotation(rotation)​

図形の回転角度を絶対値で設定します。回転できない図形の場合は無視されます。(getRotation と対称)

setRotation(rotation: number): Promise<void>;

パラメーター

名前型説明
rotationnumber回転角度(degree)

戻り値

none

setTransform(transform)​

図形の位置・サイズ・回転を一度に設定します。getTransform() の戻り値をそのまま渡せます。(getTransform と対称)値を指定したフィールドのみをサイズ→位置→回転の順に適用し、省略したフィールドは現在の値を維持します。各フィールドは個別の setter と同様に、その操作(サイズ変更/移動/回転)ができない図形では無視されます。

setTransform(transform?: Partial<ShapeTransform>): Promise<void>;

パラメーター

名前型説明
transform(省略可)Partial<ShapeTransform>位置/サイズ(px)· 回転(degree)。省略すると何も変更しません

戻り値

none

setWidth(width)​

図形の幅を設定します。サイズを変更できない図形の場合は無視されます。

setWidth(width: number): Promise<void>;

パラメーター

名前型説明
widthnumber幅(px 単位、小数第 1 位に丸め)

戻り値

none

setX(x)​

図形の X 座標を絶対値で設定します。移動できない図形の場合は無視されます。(相対移動は moveBy)

setX(x: number): Promise<void>;

パラメーター

名前型説明
xnumberX 座標(px 単位、整数に丸め)

戻り値

none

setY(y)​

図形の Y 座標を絶対値で設定します。移動できない図形の場合は無視されます。

setY(y: number): Promise<void>;

パラメーター

名前型説明
ynumberY 座標(px 単位、整数に丸め)

戻り値

none

ungroup()​

グループを解除して、子図形をスライドの最上位に分離します。解除後、この Group インスタンスと事前に取得しておいた子のハンドルは無効になります(子は新しい id を受け取ります)。

ungroup(): Promise<Shape[]>;

戻り値

Promise<Shape[]> - 分離された子図形の配列