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: load
- Excel.QueryCollection: load
- Excel.RangeAreasCollection: load
- Excel.RangeBorderCollection: load
- Excel.RangeCollection: load
- Excel.RangeViewCollection: load
- Excel.RowColumnPivotHierarchyCollection: 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: load
- OneNote.InkAnalysisParagraphCollection: load
- OneNote.InkAnalysisWordCollection: load
- OneNote.InkStrokeCollection: load
- OneNote.InkWordCollection: load
- OneNote.NotebookCollection: load
- OneNote.PageCollection: load
- OneNote.PageContentCollection: load
- OneNote.ParagraphCollection: load
- OneNote.PointCollection: load
- OneNote.SectionCollection: load
- OneNote.SectionGroupCollection: load
- OneNote.TableCellCollection: load
- OneNote.TableRowCollection: load
- PowerPoint.BindingCollection: load
- PowerPoint.CustomPropertyCollection: load
- PowerPoint.CustomXmlPartCollection: load
- PowerPoint.CustomXmlPartScopedCollection: load
- PowerPoint.HyperlinkCollection: load
- PowerPoint.HyperlinkScopedCollection: load
- PowerPoint.ShapeCollection: load
- PowerPoint.ShapeScopedCollection: load
- PowerPoint.SlideCollection: load
- PowerPoint.SlideLayoutCollection: load
- PowerPoint.SlideMasterCollection: load
- PowerPoint.SlideScopedCollection: load
- PowerPoint.TableCellCollection: load
- PowerPoint.TableColumnCollection: load
- PowerPoint.TableRowCollection: load
- PowerPoint.TagCollection: load
- Visio.CommentCollection: load
- Visio.HyperlinkCollection: load
- Visio.PageCollection: 読み込み
- Visio.ShapeCollection: load
- 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。SettingCollection: load
- Word。ShapeCollection: load
- 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: load
- Word。TableOfFiguresCollection: load
- 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 を指定すると、指定した数の項目をスキップした後に結果セットが開始されます。 |
| 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));
}
})
});