OfficeExtension.LoadOption interface
読み込むオブジェクトのプロパティを指定します。 このロードは、sync() メソッドが実行されたときに発生します。 これにより、Office オブジェクトと対応する JavaScript プロキシ オブジェクトとの間の状態が同期されます。
注釈
Word の場合、プロパティとページ情報を指定するための推奨される方法は、文字列リテラルを使用することです。 最初の 2 つの例は、段落コレクションの段落のテキストおよびフォント サイズのプロパティを要求するための推奨される方法を示しています。
context.load(paragraphs, 'text, font/size');
paragraphs.load('text, font/size');
次に、オブジェクト表記 (ページングを含む) を使用する、類似の例を示します。
context.load(paragraphs, {select: 'text, font/size', expand: 'font', top: 50, skip: 0});
paragraphs.load({select: 'text, font/size', expand: 'font', top: 50, skip: 0});
select ステートメントのフォント オブジェクトで特定のプロパティを指定しない場合、すべてのフォント プロパティが読み込まれることを expand ステートメントが単独で示します。
使用元
- Excel.AllowEditRangeCollection: load
- Excel.BindingCollection: load
- Excel.ChartCollection: load
- Excel.ChartLegendEntryCollection: load
- Excel.ChartPointsCollection: load
- Excel.ChartSeriesCollection: load
- Excel.ChartTrendlineCollection: load
- Excel.CommentCollection: load
- Excel.CommentReplyCollection: load
- Excel.ConditionalFormatCollection: load
- Excel.ConditionalRangeBorderCollection: load
- Excel.CustomPropertyCollection: load
- Excel.CustomXmlPartCollection: load
- Excel.CustomXmlPartScopedCollection: load
- Excel.DataPivotHierarchyCollection: load
- Excel.DocumentTaskChangeCollection: load
- Excel.DocumentTaskCollection: load
- Excel.FilterPivotHierarchyCollection: load
- Excel.GroupShapeCollection: load
- Excel.LinkedEntityDataDomainCollection: load
- Excel.LinkedWorkbookCollection: load
- Excel.NamedItemCollection: load
- Excel.NamedSheetViewCollection: load
- Excel.NoteCollection: load
- Excel.PageBreakCollection: load
- Excel.PaneCollection: load
- Excel.PivotFieldCollection: load
- Excel.PivotHierarchyCollection: load
- Excel.PivotItemCollection: load
- Excel.PivotTableCollection: load
- Excel.PivotTableScopedCollection: load
- Excel.PivotTableStyleCollection: 読み込み
- Excel.QueryCollection: load
- Excel.RangeAreasCollection: load
- Excel.RangeBorderCollection: load
- Excel.RangeCollection: load
- Excel.RangeViewCollection: load
- Excel.RowColumnPivotHierarchyCollection: load
- Excel.SensitivityLabelDetailsCollection: load
- Excel.SettingCollection: load
- Excel.ShapeCollection: load
- Excel.SlicerCollection: load
- Excel.SlicerItemCollection: load
- Excel.SlicerStyleCollection: load
- Excel.StyleCollection: load
- Excel.TableCollection: load
- Excel.TableColumnCollection: load
- Excel.TableRowCollection: load
- Excel.TableScopedCollection: load
- Excel.TableStyleCollection: load
- Excel.TimelineStyleCollection: load
- Excel.WindowCollection: load
- Excel.WorksheetCollection: load
- Excel.WorksheetCustomPropertyCollection: load
- OfficeExtension.ClientRequestContext: load, loadRecursive
- OneNote.InkAnalysisLineCollection: 読み込み
- OneNote.InkAnalysisParagraphCollection: load
- OneNote.InkAnalysisWordCollection: load
- OneNote.InkStrokeCollection: 読み込み
- OneNote.InkWordCollection: 読み込み
- OneNote.NotebookCollection: 読み込み
- OneNote.PageCollection: 読み込み
- OneNote.PageContentCollection: 読み込み
- OneNote.ParagraphCollection: 読み込み
- OneNote.PointCollection: 読み込み
- OneNote.SectionCollection: 読み込み
- OneNote.SectionGroupCollection: 読み込み
- OneNote.TableCellCollection: 読み込み
- OneNote.TableRowCollection: 読み込み
- PowerPoint.BindingCollection: 読み込み
- PowerPoint.CustomPropertyCollection: 読み込み
- PowerPoint.CustomXmlPartCollection: 読み込み
- PowerPoint.CustomXmlPartScopedCollection: 読み込み
- PowerPoint.HyperlinkCollection: 読み込み
- PowerPoint.HyperlinkScopedCollection: 読み込み
- PowerPoint.SensitivityLabelDetailsCollection: load
- PowerPoint.ShapeCollection: 読み込み
- PowerPoint.ShapeScopedCollection: 読み込み
- PowerPoint.SlideCollection: 読み込み
- PowerPoint.SlideLayoutCollection: 読み込み
- PowerPoint.SlideMasterCollection: 読み込み
- PowerPoint.SlideScopedCollection: 読み込み
- PowerPoint.TableCellCollection: 読み込み
- PowerPoint.TableColumnCollection: 読み込み
- PowerPoint.TableRowCollection: 読み込み
- PowerPoint.TagCollection: 読み込み
- Visio.CommentCollection: load
- Visio.HyperlinkCollection: 読み込み
- Visio.PageCollection: load
- Visio.ShapeCollection: 読み込み
- Visio.ShapeDataItemCollection: load
- Word.AnnotationCollection: load
- Word.BookmarkCollection: load
- Word.BorderCollection: load
- Word.BorderUniversalCollection: load
- Word.BreakCollection: load
- Word.CoauthorCollection: load
- Word.CoauthoringLockCollection: load
- Word.CoauthoringUpdateCollection: load
- Word.CommentCollection: load
- Word.CommentReplyCollection: load
- Word.ConflictCollection: load
- Word.ContentControlCollection: load
- Word.ContentControlListItemCollection: load
- Word.CustomPropertyCollection: load
- Word.CustomXmlNodeCollection: load
- Word.CustomXmlPartCollection: load
- Word.CustomXmlPartScopedCollection: load
- Word.CustomXmlPrefixMappingCollection: load
- Word.CustomXmlSchemaCollection: load
- Word.CustomXmlValidationErrorCollection: load
- Word.DocumentLibraryVersionCollection: load
- Word.FieldCollection: load
- Word.FrameCollection: load
- Word.HeadingStyleCollection: load
- Word.HtmlDivisionCollection: load
- Word.HyperlinkCollection: load
- Word.IndexCollection: load
- Word.InlinePictureCollection: load
- Word.ListCollection: load
- Word.ListLevelCollection: load
- Word.ListTemplateCollection: load
- Word.ListTemplateGalleryCollection: load
- Word.NoteItemCollection: load
- Word.PageCollection: load
- Word.PaneCollection: load
- Word.ParagraphCollection: load
- Word.RangeCollection: load
- Word.RangeScopedCollection: load
- Word.ReadabilityStatisticCollection: load
- Word.ReviewerCollection: load
- Word.RevisionCollection: load
- Word.SectionCollection: load
- Word.SensitivityLabelDetailsCollection: load
- Word.SettingCollection: load
- Word.ShapeCollection: 読み込み
- Word.SourceCollection: load
- Word.StyleCollection: load
- Word.TabStopCollection: load
- Word.TableCellCollection: load
- Word.TableCollection: load
- Word.TableColumnCollection: load
- Word.TableOfAuthoritiesCategoryCollection: load
- Word.TableOfAuthoritiesCollection: load
- Word.TableOfContentsCollection: 読み込み
- Word.TableOfFiguresCollection: 読み込み
- Word.TableRowCollection: load
- Word.TemplateCollection: load
- Word.TextColumnCollection: load
- Word.TrackedChangeCollection: load
- Word.WindowCollection: load
- Word.XmlNodeCollection: load
例
// This example shows how to get the paragraphs in the Word document
// along with their text and font size properties.
// Run a batch operation against the Word object model.
Word.run(function (context) {
// Create a proxy object for the paragraphs collection.
const paragraphs = context.document.body.paragraphs;
// Queue a command to load the text and font properties.
// It is best practice to always specify the property set.
// Otherwise, all properties are returned on the object.
context.load(paragraphs, 'text, font/size');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
return context.sync().then(function () {
// Insert code that works with the paragraphs loaded by context.load().
})
})
.catch(function (error) {
console.log('Error: ' + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log('Debug info: ' + JSON.stringify(error.debugInfo));
}
});
プロパティ
| expand | 読み込むナビゲーション プロパティを指定するコンマ区切りの文字列または文字列の配列。 |
| select | 読み込むプロパティを指定するコンマ区切りの文字列、または文字列の配列。 |
| skip | コレクション型でのみ使用できます。 スキップして結果に含めないコレクション内の項目の数を指定します。
|
| top | コレクション型でのみ使用できます。 結果に含めることができるコレクション項目の最大数を指定します。 |
プロパティの詳細
expand
読み込むナビゲーション プロパティを指定するコンマ区切りの文字列または文字列の配列。
expand?: string | string[];
プロパティ値
string | string[]
select
読み込むプロパティを指定するコンマ区切りの文字列、または文字列の配列。
select?: string | string[];
プロパティ値
string | string[]
skip
コレクション型でのみ使用できます。 スキップして結果に含めないコレクション内の項目の数を指定します。
top が指定されている場合は、指定された数の項目がスキップされた後で結果セットが開始されます。
skip?: number;
プロパティ値
number
top
コレクション型でのみ使用できます。 結果に含めることができるコレクション項目の最大数を指定します。
top?: number;
プロパティ値
number
例
// This OneNote example shows how to get the page title and indentation level
// of the top five pages in the current section.
OneNote.run(function (context) {
// Get the pages in the current section.
const pages = context.application.getActiveSection().pages;
// Queue a command to load the pages.
pages.load({ "select":"title,pageLevel", "top":5, "skip":0 });
return context.sync()
.then(function() {
// Iterate through the collection of pages.
$.each(pages.items, function(index, page) {
// Show some properties.
console.log("Page title: " + page.title);
console.log("Indentation level: " + page.pageLevel);
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
})
});