ExcelScript.DocumentProperties interface

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

注釈

/**
 * This script creates a new worksheet that displays some of the document properties.
 */
function main(workbook: ExcelScript.Workbook) {
    // Get the document properties.
    const properties: ExcelScript.DocumentProperties = workbook.getProperties();

    // Create a new worksheet called "Metadata".
    const newWorksheet = workbook.addWorksheet("Metadata");
    
    // Create an array to store the string values of properties to save.
    let values: string[][] = [];
    values.push(["Creation Date", properties.getCreationDate().toString()]);
    values.push(["Author", properties.getAuthor()]);
    values.push(["Last Edited By", properties.getLastAuthor()]);
    
    // Set the property values to a range on the new worksheet.
    newWorksheet.getRange("A1:B3").setValues(values);
}

メソッド

addCustomProperty(key, value)

新しいカスタム プロパティを作成、または既存のカスタム プロパティを設定します。

deleteAllCustomProperties()

このコレクション内のすべてのカスタム プロパティを削除します。

getAuthor()

ブックの作成者。

getCategory()

ブックのカテゴリ。

getComments()

ブックのコメント。

getCompany()

ブックの会社。

getCreationDate()

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

getCustom()

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

getCustomProperty(key)

キーを使用してカスタム プロパティ オブジェクトを取得します。大文字と小文字は区別されません。 カスタム プロパティが存在しない場合、このメソッドは を返します undefined

getKeywords()

ブックのキーワード。

getLastAuthor()

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

getManager()

ブックのマネージャー。

getRevisionNumber()

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

getSubject()

ブックの件名。

getTitle()

ブックのタイトル。

setAuthor(author)

ブックの作成者。

setCategory(category)

ブックのカテゴリ。

setComments(comments)

ブックのコメント。

setCompany(company)

ブックの会社。

setKeywords(keywords)

ブックのキーワード。

setManager(manager)

ブックのマネージャー。

setRevisionNumber(revisionNumber)

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

setSubject(subject)

ブックの件名。

setTitle(title)

ブックのタイトル。

メソッドの詳細

addCustomProperty(key, value)

新しいカスタム プロパティを作成、または既存のカスタム プロパティを設定します。

addCustomProperty(key: string, value: any): CustomProperty;

パラメーター

key

string

必須です。 カスタム プロパティのキー。大文字と小文字は区別されません。 キーは、Excel on the webの外部で 255 文字に制限されています (大きいキーは、他のプラットフォームでは自動的に 255 文字にトリミングされます)。

value

any

必須です。 カスタム プロパティの値。 値は、Excel on the webの外部で 255 文字に制限されています (大きい値は、他のプラットフォームでは自動的に 255 文字にトリミングされます)。

戻り値

/**
 * This script adds a workbook-level custom property.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the property collection.
  const properties = workbook.getProperties();

  // Add a new property called "Project" with the value "FA".
  properties.addCustomProperty("Project", "FA");
}

deleteAllCustomProperties()

このコレクション内のすべてのカスタム プロパティを削除します。

deleteAllCustomProperties(): void;

戻り値

void

getAuthor()

ブックの作成者。

getAuthor(): string;

戻り値

string

getCategory()

ブックのカテゴリ。

getCategory(): string;

戻り値

string

getComments()

ブックのコメント。

getComments(): string;

戻り値

string

getCompany()

ブックの会社。

getCompany(): string;

戻り値

string

getCreationDate()

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

getCreationDate(): Date;

戻り値

Date

getCustom()

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

getCustom(): CustomProperty[];

戻り値

getCustomProperty(key)

キーを使用してカスタム プロパティ オブジェクトを取得します。大文字と小文字は区別されません。 カスタム プロパティが存在しない場合、このメソッドは を返します undefined

getCustomProperty(key: string): CustomProperty | undefined;

パラメーター

key

string

必須です。 カスタム プロパティ オブジェクトを識別するキー。

戻り値

/**
 * This script gets a workbook-level custom property called "Project".
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the property collection.
  const properties = workbook.getProperties();

  // Get the "Project" property.
  const project = properties.getCustomProperty("Project");

  // Show the property value in the console.
  console.log(project.getValue());
}

getKeywords()

ブックのキーワード。

getKeywords(): string;

戻り値

string

getLastAuthor()

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

getLastAuthor(): string;

戻り値

string

getManager()

ブックのマネージャー。

getManager(): string;

戻り値

string

getRevisionNumber()

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

getRevisionNumber(): number;

戻り値

number

getSubject()

ブックの件名。

getSubject(): string;

戻り値

string

getTitle()

ブックのタイトル。

getTitle(): string;

戻り値

string

setAuthor(author)

ブックの作成者。

setAuthor(author: string): void;

パラメーター

author

string

戻り値

void

setCategory(category)

ブックのカテゴリ。

setCategory(category: string): void;

パラメーター

category

string

戻り値

void

setComments(comments)

ブックのコメント。

setComments(comments: string): void;

パラメーター

comments

string

戻り値

void

setCompany(company)

ブックの会社。

setCompany(company: string): void;

パラメーター

company

string

戻り値

void

setKeywords(keywords)

ブックのキーワード。

setKeywords(keywords: string): void;

パラメーター

keywords

string

戻り値

void

setManager(manager)

ブックのマネージャー。

setManager(manager: string): void;

パラメーター

manager

string

戻り値

void

setRevisionNumber(revisionNumber)

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

setRevisionNumber(revisionNumber: number): void;

パラメーター

revisionNumber

number

戻り値

void

setSubject(subject)

ブックの件名。

setSubject(subject: string): void;

パラメーター

subject

string

戻り値

void

setTitle(title)

ブックのタイトル。

setTitle(title: string): void;

パラメーター

title

string

戻り値

void