Excel.DocumentProperties class

ブックのプロパティを表します。

Extends

プロパティ

author

ブックの作成者。

category

ブックのカテゴリ。

comments

ブックのメタデータの [コメント] フィールド。 これらは、ブックで行われたユーザーによるコメントとは関係ありません。

company

ブックの会社。

context

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

creationDate

ブックの作成日を取得します。

custom

ブックのカスタム プロパティのコレクションを取得します。

keywords

ブックのキーワード。

lastAuthor

ブックの最後の作成者を取得します。

manager

ブックの管理者。

revisionNumber

ブックのリビジョン番号を取得します。

subject

ブックの件名。

title

ブックのタイトルです。

メソッド

load(options)

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

load(propertyNames)

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

load(propertyNamesAndPaths)

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

set(properties, options)

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

set(properties)

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

toJSON()

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

プロパティの詳細

author

ブックの作成者。

author: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

category

ブックのカテゴリ。

category: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

comments

ブックのメタデータの [コメント] フィールド。 これらは、ブックで行われたユーザーによるコメントとは関係ありません。

comments: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

company

ブックの会社。

company: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

context

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

context: RequestContext;

プロパティ値

creationDate

ブックの作成日を取得します。

readonly creationDate: Date;

プロパティ値

Date

注釈

API セット: ExcelApi 1.7

custom

ブックのカスタム プロパティのコレクションを取得します。

readonly custom: Excel.CustomPropertyCollection;

プロパティ値

注釈

API セット: ExcelApi 1.7

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/26-document/custom-properties.yaml

await Excel.run(async (context) => {
  // Load the keys and values of all custom properties.
  const customDocProperties = context.workbook.properties.custom;
  customDocProperties.load(["key", "value"]);
  await context.sync();

  // Log each custom property to the console.
  // Note that your document may have more properties than those you have set using this snippet.
  customDocProperties.items.forEach((property) => {
    console.log(`${property.key}: ${property.value}`);
  });
});

keywords

ブックのキーワード。

keywords: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

lastAuthor

ブックの最後の作成者を取得します。

readonly lastAuthor: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

manager

ブックの管理者。

manager: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

revisionNumber

ブックのリビジョン番号を取得します。

revisionNumber: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.7

subject

ブックの件名。

subject: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

title

ブックのタイトルです。

title: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.7

メソッドの詳細

load(options)

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

load(options?: Excel.Interfaces.DocumentPropertiesLoadOptions): Excel.DocumentProperties;

パラメーター

options
Excel.Interfaces.DocumentPropertiesLoadOptions

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

返品

load(propertyNames)

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

load(propertyNames?: string | string[]): Excel.DocumentProperties;

パラメーター

propertyNames

string | string[]

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

返品

load(propertyNamesAndPaths)

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

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Excel.DocumentProperties;

パラメーター

propertyNamesAndPaths

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

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

返品

set(properties, options)

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

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

パラメーター

properties
Excel.Interfaces.DocumentPropertiesUpdateData

メソッドが呼び出されたオブジェクトのプロパティと同型構造のプロパティを持つ JavaScript オブジェクト。

options
OfficeExtension.UpdateOptions

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

返品

void

set(properties)

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

set(properties: Excel.DocumentProperties): void;

パラメーター

返品

void

toJSON()

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

toJSON(): Excel.Interfaces.DocumentPropertiesData;

返品