OfficeExtension.LoadOption interface
Especifica as propriedades de um objeto que devem ser carregadas. Esta carga ocorre quando o método sync() é executado. Esta ação sincroniza os estados entre objetos do Office e objetos proxy JavaScript correspondentes.
Comentários
Para Word, o método preferencial para especificar as propriedades e as informações de paginação é utilizar um literal de cadeia. Os dois primeiros exemplos mostram a forma preferencial para solicitar as propriedades de texto e tamanho de fonte dos parágrafos em uma coleção de parágrafos:
context.load(paragraphs, 'text, font/size');
paragraphs.load('text, font/size');
Veja um exemplo parecido usando notação de objeto (inclui paginação):
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});
Observe que, quando não determinamos as propriedades específicas do objeto Font na instrução Select, a instrução de expansão em si indica que todas as propriedades da fonte são carregadas.
Usada por
- Excel.AllowEditRangeCollection: carregar
- Excel.BindingCollection: carregar
- Excel.ChartCollection: carregar
- Excel.ChartLegendEntryCollection: carregar
- Excel.ChartPointsCollection: carregar
- Excel.ChartSeriesCollection: carregar
- Excel.ChartTrendlineCollection: carregar
- Excel.CommentCollection: carregar
- Excel.CommentReplyCollection: carregar
- Excel.ConditionalFormatCollection: carregar
- Excel.ConditionalRangeBorderCollection: carregar
- Excel.CustomPropertyCollection: carregar
- Excel.CustomXmlPartCollection: carregar
- Excel.CustomXmlPartScopedCollection: carregar
- Excel.DataPivotHierarchyCollection: carregar
- Excel.DocumentTaskChangeCollection: carregar
- Excel.DocumentTaskCollection: carregar
- Excel.FilterPivotHierarchyCollection: carregar
- Excel.GroupShapeCollection: carregar
- Excel.LinkedEntityDataDomainCollection: carregar
- Excel.LinkedWorkbookCollection: carregar
- Excel.NamedItemCollection: carregar
- Excel.NamedSheetViewCollection: carregar
- Excel.NoteCollection: carregar
- Excel.PageBreakCollection: carregar
- Excel.PaneCollection: carregar
- Excel.PivotFieldCollection: carregar
- Excel.PivotHierarchyCollection: carregar
- Excel.PivotItemCollection: carregar
- Excel.PivotTableCollection: carregar
- Excel.PivotTableScopedCollection: carregar
- Excel.PivotTableStyleCollection: carregar
- Excel.QueryCollection: carregar
- Excel.RangeAreasCollection: carregar
- Excel.RangeBorderCollection: carregar
- Excel.RangeCollection: carregar
- Excel.RangeViewCollection: carregar
- Excel.RowColumnPivotHierarchyCollection: load
- Excel.SettingCollection: carregar
- Excel.ShapeCollection: carregar
- Excel.SlicerCollection: carregar
- Excel.SlicerItemCollection: carregar
- Excel.SlicerStyleCollection: carregar
- Excel.StyleCollection: carregar
- Excel.TableCollection: carregar
- Excel.TableColumnCollection: carregar
- Excel.TableRowCollection: carregar
- Excel.TableScopedCollection: carregar
- Excel.TableStyleCollection: carregar
- Excel.TimelineStyleCollection: carregar
- Excel.WindowCollection: carregar
- Excel.WorksheetCollection: carregar
- Excel.WorksheetCustomPropertyCollection: carregar
- OfficeExtension.ClientRequestContext: load, loadRecursive
- OneNote.InkAnalysisLineCollection: carregar
- OneNote.InkAnalysisParagraphCollection: carregar
- OneNote.InkAnalysisWordCollection: carregar
- OneNote.InkStrokeCollection: carregar
- OneNote.InkWordCollection: carregar
- OneNote.NotebookCollection: carregar
- OneNote.PageCollection: carregar
- OneNote.PageContentCollection: carregar
- OneNote.ParagraphCollection: carregar
- OneNote.PointCollection: carregar
- OneNote.SectionCollection: carregar
- OneNote.SectionGroupCollection: carregar
- OneNote.TableCellCollection: carregar
- OneNote.TableRowCollection: carregar
- PowerPoint.BindingCollection: carregar
- PowerPoint.CustomPropertyCollection: carregar
- PowerPoint.CustomXmlPartCollection: carregar
- PowerPoint.CustomXmlPartScopedCollection: carregar
- PowerPoint.HyperlinkCollection: carregar
- PowerPoint.HyperlinkScopedCollection: carregar
- PowerPoint.ShapeCollection: carregar
- PowerPoint.ShapeScopedCollection: carregar
- PowerPoint.SlideCollection: carregar
- PowerPoint.SlideLayoutCollection: carregar
- PowerPoint.SlideMasterCollection: carregar
- PowerPoint.SlideScopedCollection: carregar
- PowerPoint.TableCellCollection: carregar
- PowerPoint.TableColumnCollection: carregar
- PowerPoint.TableRowCollection: carregar
- PowerPoint.TagCollection: carregar
- Visio.CommentCollection: carregar
- Visio.HyperlinkCollection: carregar
- Visio.PageCollection: carregar
- Visio.ShapeCollection: carregar
- Visio.ShapeDataItemCollection: carregar
- Word. AnnotationCollection: carregar
- Word. BookmarkCollection: carregar
- Word. BorderCollection: carregar
- Word. BorderUniversalCollection: carregamento
- Word. BreakCollection: carregar
- Word. CoauthorCollection: carregar
- Word. CoauthoringLockCollection: carregar
- Word. CoauthoringUpdateCollection: load
- Word. CommentCollection: carregar
- Word. CommentReplyCollection: carregar
- Word. ConflictCollection: carregamento
- Word. ContentControlCollection: carregar
- Word. ContentControlListItemCollection: carregar
- Word. CustomPropertyCollection: carregar
- Word. CustomXmlNodeCollection: carregar
- Word. CustomXmlPartCollection: carregar
- Word. CustomXmlPartScopedCollection: carregamento
- Word. CustomXmlPrefixMappingCollection: carregamento
- Word. CustomXmlSchemaCollection: carregamento
- Word. CustomXmlValidationErrorCollection: load
- Word. DocumentLibraryVersionCollection: carregar
- Word. FieldCollection: carregar
- Word. FrameCollection: carregar
- Word. HeadingStyleCollection: carregar
- Word. HtmlDivisionCollection: carregar
- Word. HyperlinkCollection: carregar
- Word. IndexCollection: carregamento
- Word. InlinePictureCollection: carregar
- Word. ListCollection: carregar
- Word. ListLevelCollection: carregar
- Word. ListTemplateCollection: carregar
- Word. ListTemplateGalleryCollection: carregar
- Word. NoteItemCollection: carregar
- Word. PageCollection: carregar
- Word. PaneCollection: carregar
- Word. ParagraphCollection: carregar
- Word. RangeCollection: carregar
- Word. RangeScopedCollection: carregamento
- Word. ReadabilityStatisticCollection: load
- Word. ReviewerCollection: load
- Word. RevisionCollection: carregar
- Word. SectionCollection: carregar
- Word. SettingCollection: carregar
- Word. ShapeCollection: carregar
- Word. SourceCollection: carregar
- Word. StyleCollection: carregar
- Word. TabStopCollection: carregar
- Word. TableCellCollection: carregar
- Word. TableCollection: carregar
- Word. TableColumnCollection: carregamento
- Word. TableOfAuthoritiesCategoryCollection: load
- Word. TableOfAuthoritiesCollection: load
- Word. TableOfContentsCollection: carregar
- Word. TableOfFiguresCollection: carregar
- Word. TableRowCollection: carregar
- Word. TemplateCollection: carregar
- Word. TextColumnCollection: carregar
- Word. TrackedChangeCollection: carregamento
- Word. WindowCollection: carregar
- Word. XmlNodeCollection: carregar
Exemplos
// 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));
}
});
Propriedades
| expand | Uma cadeia delimitada por vírgulas, ou matriz de cadeias, que especifica as propriedades de navegação a carregar. |
| select | Uma cadeia delimitada por vírgulas, ou matriz de cadeias, que especifica as propriedades a carregar. |
| skip | Apenas utilizável em tipos de coleção. Especifica o número de itens na coleção que devem ser ignorados e não incluídos no resultado. Se a parte superior for especificada, o conjunto de resultados será iniciado depois de ignorar o número especificado de itens. |
| top | Apenas utilizável em tipos de coleção. Especifica o número máximo de itens da coleção que podem ser incluídos no resultado. |
Detalhes da propriedade
expand
Uma cadeia delimitada por vírgulas, ou matriz de cadeias, que especifica as propriedades de navegação a carregar.
expand?: string | string[];
Valor da propriedade
string | string[]
select
Uma cadeia delimitada por vírgulas, ou matriz de cadeias, que especifica as propriedades a carregar.
select?: string | string[];
Valor da propriedade
string | string[]
skip
Apenas utilizável em tipos de coleção. Especifica o número de itens na coleção que devem ser ignorados e não incluídos no resultado. Se a parte superior for especificada, o conjunto de resultados será iniciado depois de ignorar o número especificado de itens.
skip?: number;
Valor da propriedade
number
top
Apenas utilizável em tipos de coleção. Especifica o número máximo de itens da coleção que podem ser incluídos no resultado.
top?: number;
Valor da propriedade
number
Exemplos
// 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));
}
})
});