Show.Control
Show.Control は Presentation モジュール(Office.show(iframe))のオブジェクト型です。メソッド 35 個。
備考
- モジュール: Presentation ·
Office.show(iframe)· 名前空間Show - 取得方法: 他のオブジェクト型の概要表にあるメソッドが値として返します
- すべてのメソッドは
Promiseを返し、シグネチャは TypeScript 表記です。
メソッド
| メソッド | 説明 |
|---|---|
align(alignType) | 図形をスライド基準で配置します。 |
flip(direction) | 図形を上下または左右に反転します。 |
getHeight() | 図形の高さを返します。 |
getHyperlink() | 図形に設定されたハイパーリンクを返します。 |
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 だけ相対移動します。 |
removeHyperlink() | 図形のハイパーリンクを削除します。 |
reorder(order) | 図形の重なり順(前面へ/背面へ)を変更します。 |
setHeight(height) | 図形の高さを設定します。 |
setHyperlink(hyperlink) | 図形にハイパーリンクを設定します。 |
setRotation(rotation) | 図形の回転角度を絶対値で設定します。 |
setTransform(transform) | 図形の位置・サイズ・回転を一度に設定します。 |
setWidth(width) | 図形の幅を設定します。 |
setX(x) | 図形の X 座標を絶対値で設定します。 |
setY(y) | 図形の Y 座標を絶対値で設定します。 |
メソッドの詳細
align(alignType)
図形をスライド基準で配置します。移動できない図形の場合は無視されます。グループの子も、グループ内ではなくスライドを基準に移動します。子がグループの外に出ると、グループは子を含むように一緒に広がります。
align(alignType: AlignType): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
alignType | AlignType | 配置の種類 |
戻り値
none
flip(direction)
図形を上下または左右に反転します。現在の反転状態を切り替えるトグルで、現在反転しているかどうかは isFlippedH()/isFlippedV() で読み取ります。回転できない図形では反転も無視されます。回転した図形は角度も鏡像として一緒に変わります(getRotation() の値が 360 - 元の角度 に変わります)。
flip(direction: FlipDirection): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
direction | FlipDirection | 反転方向 |
戻り値
none
getHeight()
図形の高さを返します。(setHeight と対称)
getHeight(): Promise<number | null>;
戻り値
Promise<number | null> - 高さ(px 単位)。対象の図形がない場合は null
getHyperlink()
図形に設定されたハイパーリンクを返します。返されたオブジェクトはそのまま setHyperlink に渡せます。ただし、Web アドレスの検査を通過しない url リンクは例外です。サポートされていない種類(プログラムの実行・マクロなど)が設定されている場合は null です。クリック時に動作するハイパーリンクのみを読み取ります - setHyperlink/removeHyperlink と対象は同じです(マウスを重ねたときに動作するリンクは対象外です)。文字(run)単位で設定されたテキストリンクは Shape.getTextHyperlink で読み取ります。
getHyperlink(): Promise<Hyperlink | null>;
戻り値
Promise<Hyperlink | null> - ハイパーリンク情報。ハイパーリンクがない場合は 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>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
distance | ShapeMoveDistance | 移動量(px 単位) |
戻り値
none
removeHyperlink()
図形のハイパーリンクを削除します。文字(run)単位のテキストリンクは Shape.removeTextHyperlink で削除します。
removeHyperlink(): Promise<void>;
戻り値
none
reorder(order)
図形の重なり順(前面へ/背面へ)を変更します。すでに目標の位置にあり変更がない場合は無視されます。
reorder(order: ShapeZOrder): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
order | ShapeZOrder | 順序変更の種類 |
戻り値
none
setHeight(height)
図形の高さを設定します。サイズを変更できない図形の場合は無視されます。
setHeight(height: number): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
height | number | 高さ(px 単位、小数第 1 位に丸め) |
戻り値
none
setHyperlink(hyperlink)
図形にハイパーリンクを設定します。(getHyperlink と対称 - 返されたオブジェクトをそのまま渡してハイパーリンクをコピーできます。ただし、Web アドレスの検査を通過しない url リンクは例外です)url リンクのアドレスが空でない場合、http:// または https:// で始まらないアドレスの先頭に http:// を付け、その結果が Web アドレスである必要があります。空の url アドレス、サポートされていない種類、無効な対象(削除されたスライドなど)は無視されます。文字(run)単位のテキストリンクは Shape.setTextHyperlink で設定します。
setHyperlink(hyperlink: Hyperlink | null): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
hyperlink | Hyperlink | null | ハイパーリンク情報。null の場合はハイパーリンクを削除します(removeHyperlink と同じ動作)。type がない場合は無視します |
戻り値
none
setRotation(rotation)
図形の回転角度を絶対値で設定します。回転できない図形の場合は無視されます。(getRotation と対称)
setRotation(rotation: number): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
rotation | number | 回転角度(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>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
width | number | 幅(px 単位、小数第 1 位に丸め) |
戻り値
none
setX(x)
図形の X 座標を絶対値で設定します。移動できない図形の場合は無視されます。(相対移動は moveBy)
setX(x: number): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
x | number | X 座標(px 単位、整数に丸め) |
戻り値
none
setY(y)
図形の Y 座標を絶対値で設定します。移動できない図形の場合は無視されます。
setY(y: number): Promise<void>;
パラメーター
| 名前 | 型 | 説明 |
|---|---|---|
y | number | Y 座標(px 単位、整数に丸め) |
戻り値
none