Visio.Shape class

図形クラスを表します。

Extends

注釈

[ API セット: 1.1 ]

プロパティ

comments

Comments コレクションを返します。

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

hyperlinks

図形オブジェクトのハイパーリンク コレクションを返します。

id

図形の識別子。

name

図形の名前。

select

図形が選択されている場合は true を返します。 ユーザーが true に設定すれば、明示的に図形を選択できます。

shapeDataItems

図形のデータ セクションを返します。

subShapes

SubShape コレクションを取得します。

text

図形のテキスト。

view

図形のビューを返します。

メソッド

getAbsoluteBounds()

図形の絶対境界ボックスを指定する AbsoluteBoundingBox オブジェクトを返します。

getBounds()

図形の境界ボックスを指定する BoundingBox オブジェクトを返します。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

setMockData(data)

モック データを設定する

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の Visio.Shape オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として Visio.Interfaces.ShapeData型指定) を返します。

プロパティの詳細

comments

Comments コレクションを返します。

readonly comments: Visio.CommentCollection;

プロパティ値

注釈

[ API セット: 1.1 ]

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

図形オブジェクトのハイパーリンク コレクションを返します。

readonly hyperlinks: Visio.HyperlinkCollection;

プロパティ値

注釈

[ API セット: 1.1 ]

id

図形の識別子。

readonly id: number;

プロパティ値

number

注釈

[ API セット: 1.1 ]

name

図形の名前。

readonly name: string;

プロパティ値

string

注釈

[ API セット: 1.1 ]

select

図形が選択されている場合は true を返します。 ユーザーが true に設定すれば、明示的に図形を選択できます。

select: boolean;

プロパティ値

boolean

注釈

[ API セット: 1.1 ]

shapeDataItems

図形のデータ セクションを返します。

readonly shapeDataItems: Visio.ShapeDataItemCollection;

プロパティ値

注釈

[ API セット: 1.1 ]

subShapes

SubShape コレクションを取得します。

readonly subShapes: Visio.ShapeCollection;

プロパティ値

注釈

[ API セット: 1.1 ]

text

図形のテキスト。

readonly text: string;

プロパティ値

string

注釈

[ API セット: 1.1 ]

view

図形のビューを返します。

readonly view: Visio.ShapeView;

プロパティ値

注釈

[ API セット: 1.1 ]

メソッドの詳細

getAbsoluteBounds()

図形の絶対境界ボックスを指定する AbsoluteBoundingBox オブジェクトを返します。

getAbsoluteBounds(): OfficeExtension.ClientResult<Visio.BoundingBox>;

戻り値

注釈

[ API セット: 1.1 ]

getBounds()

図形の境界ボックスを指定する BoundingBox オブジェクトを返します。

getBounds(): OfficeExtension.ClientResult<Visio.BoundingBox>;

戻り値

注釈

[ API セット: 1.1 ]

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: Visio.Interfaces.ShapeLoadOptions): Visio.Shape;

パラメーター

options
Visio.Interfaces.ShapeLoadOptions

読み込むオブジェクトのプロパティのオプションを提供します。

戻り値

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames?: string | string[]): Visio.Shape;

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。

戻り値

Visio.run(session, function (ctx) {
    const activePage = ctx.document.getActivePage();
    const shapeName = "Sample Name";
    const shape = activePage.shapes.getItem(shapeName);
    shape.load(["name", "id", "text", "select"]);
    return ctx.sync().then(function () {
        console.log(shape.name);
        console.log(shape.id);
        console.log(shape.text);
        console.log(shape.select);
    });
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});
Visio.run(session, function (ctx) {
    const activePage = ctx.document.getActivePage();
    const shape = activePage.shapes.getItem(0);
    shape.view.highlight = { color: "#E7E7E7", width: 100 };
    return ctx.sync();
}).catch(function(error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Visio.Shape;

パラメーター

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select は、読み込むプロパティを指定するコンマ区切り文字列で propertyNamesAndPaths.expand 、読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。

戻り値

set(properties, options)

オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。

set(properties: Interfaces.ShapeUpdateData, options?: OfficeExtension.UpdateOptions): void;

パラメーター

properties
Visio.Interfaces.ShapeUpdateData

メソッドが呼び出されるオブジェクトのプロパティに等形的に構造化されたプロパティを持つ JavaScript オブジェクト。

options
OfficeExtension.UpdateOptions

properties オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。

戻り値

void

set(properties)

既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。

set(properties: Visio.Shape): void;

パラメーター

properties
Visio.Shape

戻り値

void

setMockData(data)

モック データを設定する

setMockData(data: Visio.Interfaces.ShapeData): void;

パラメーター

戻り値

void

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の Visio.Shape オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として Visio.Interfaces.ShapeData型指定) を返します。

toJSON(): Visio.Interfaces.ShapeData;

戻り値