Excel.Note class

ブックまたはワークシート内のメモを表します。

Extends

注釈

API セット: ExcelApi 1.18

使用元

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function changes the height and width of the first note.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const note = sheet.notes.getItemAt(0);
  note.height = 200;
  note.width = 400;
  await context.sync();
});

プロパティ

authorName

メモの作成者を取得します。

content

メモのテキストを指定します。

context

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

height

ノートの高さを指定します。 注: このプロパティは Excel on the web ではサポートされていません。

visible

メモの表示形式を指定します。 値 true は、メモが表示されていることを意味します。 注: このプロパティは Excel on the web ではサポートされていません。

width

ノートの幅を指定します。 注: このプロパティは Excel on the web ではサポートされていません。

メソッド

delete()

メモを削除します。

getLocation()

このメモがあるセルを取得します。

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.Note オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、元のオブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.NoteData と型指定) を返します。

プロパティの詳細

authorName

メモの作成者を取得します。

readonly authorName: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.18

content

メモのテキストを指定します。

content: string;

プロパティ値

string

注釈

API セット: ExcelApi 1.18

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function changes the content in the first note.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const note = sheet.notes.getItemAt(0);
  note.content = "Changing the content of the first note.";
  await context.sync();
});

context

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

context: RequestContext;

プロパティ値

height

ノートの高さを指定します。 注: このプロパティは Excel on the web ではサポートされていません。

height: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.18

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function changes the height and width of the first note.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const note = sheet.notes.getItemAt(0);
  note.height = 200;
  note.width = 400;
  await context.sync();
});

visible

メモの表示形式を指定します。 値 true は、メモが表示されていることを意味します。 注: このプロパティは Excel on the web ではサポートされていません。

visible: boolean;

プロパティ値

boolean

注釈

API セット: ExcelApi 1.18

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function sets the note on cell A1 to visible.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const firstNote = sheet.notes.getItem("A1");

  firstNote.load();
  await context.sync();

  firstNote.visible = true;
});

width

ノートの幅を指定します。 注: このプロパティは Excel on the web ではサポートされていません。

width: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.18

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function changes the height and width of the first note.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const note = sheet.notes.getItemAt(0);
  note.height = 200;
  note.width = 400;
  await context.sync();
});

メソッドの詳細

delete()

メモを削除します。

delete(): void;

返品

void

注釈

API セット: ExcelApi 1.18

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comments-and-notes/excel-note-basics.yaml

// This function deletes the note from cell A2.
await Excel.run(async (context) => {
  const sheet = context.workbook.worksheets.getItem("Notes");
  const note = sheet.notes.getItem("A2");
  note.delete();

  await context.sync();
});

getLocation()

このメモがあるセルを取得します。

getLocation(): Excel.Range;

返品

注釈

API セット: ExcelApi 1.18

load(options)

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

load(options?: Excel.Interfaces.NoteLoadOptions): Excel.Note;

パラメーター

options
Excel.Interfaces.NoteLoadOptions

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

返品

load(propertyNames)

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

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

パラメーター

propertyNames

string | string[]

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

返品

load(propertyNamesAndPaths)

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

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

パラメーター

propertyNamesAndPaths

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

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

返品

set(properties, options)

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

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

パラメーター

properties
Excel.Interfaces.NoteUpdateData

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

options
OfficeExtension.UpdateOptions

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

返品

void

set(properties)

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

set(properties: Excel.Note): void;

パラメーター

properties
Excel.Note

返品

void

toJSON()

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

toJSON(): Excel.Interfaces.NoteData;

返品