Excel.Note class
ブックまたはワークシート内のメモを表します。
- Extends
注釈
例
// 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();
});
プロパティ
| author |
ノートの作成者を取得します。 |
| content | ノートのテキストを指定します。 |
| context | オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。 |
| height | ノートの高さを指定します。 注: このプロパティは、Excel on the webではサポートされていません。 |
| visible | ノートの可視性を指定します。
|
| width | ノートの幅を指定します。 注: このプロパティは、Excel on the webではサポートされていません。 |
メソッド
| delete() | メモを削除します。 |
| get |
このメモが配置されているセルを取得します。 |
| load(options) | オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| load(property |
オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、 |
| set(properties, options) | オブジェクトの複数のプロパティを同時に設定します。 適切なプロパティを持つプレーン オブジェクトまたは同じ型の別の API オブジェクトを渡すことができます。 |
| set(properties) | 既存の読み込まれたオブジェクトに基づいて、オブジェクトに複数のプロパティを同時に設定します。 |
| toJSON() | API オブジェクトが |
プロパティの詳細
authorName
content
ノートのテキストを指定します。
content: string;
プロパティ値
string
注釈
例
// 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
注釈
例
// 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
注釈
例
// 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
注釈
例
// 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
注釈
例
// 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()
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
properties オブジェクトが読み取り専用プロパティを設定しようとした場合にエラーを抑制するオプションを提供します。
戻り値
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;