ExcelScript.PivotHierarchy interface

Representa la instancia de PivotHierarchy de Excel.

Comentarios

Ejemplos

/**
 * This script creates a PivotTable from an existing table and adds it to a new worksheet.
 * This script assumes there is a table in the current worksheet with columns named "Type" and "Sales".
 */
function main(workbook: ExcelScript.Workbook) {
  // Create a PivotTable based on a table in the current worksheet.
  let sheet = workbook.getActiveWorksheet();
  let table = sheet.getTables()[0];

  // Add the PivotTable to a new worksheet.
  let newSheet = workbook.addWorksheet("Pivot");
  let pivotTable = newSheet.addPivotTable("My Pivot", table, "A1");

  // Add fields to the PivotTable to show "Sales" per "Type".
  pivotTable.addRowHierarchy(pivotTable.getHierarchy("Type"));
  pivotTable.addDataHierarchy(pivotTable.getHierarchy("Sales"));
}

Métodos

getFields()

Devuelve los PivotFields asociados con PivotHierarchy.

getId()

Identificador de pivotHierarchy.

getName()

Nombre de la PivotHierarchy.

getPivotField(name)

Obtiene un pivotfield por nombre. Si pivotField no existe, este método devuelve undefined.

setName(name)

Nombre de la PivotHierarchy.

Detalles del método

getFields()

Devuelve los PivotFields asociados con PivotHierarchy.

getFields(): PivotField[];

Devoluciones

getId()

Identificador de pivotHierarchy.

getId(): string;

Devoluciones

string

getName()

Nombre de la PivotHierarchy.

getName(): string;

Devoluciones

string

getPivotField(name)

Obtiene un pivotfield por nombre. Si pivotField no existe, este método devuelve undefined.

getPivotField(name: string): PivotField | undefined;

Parámetros

name

string

Nombre del campo dinámico que se va a recuperar.

Devoluciones

setName(name)

Nombre de la PivotHierarchy.

setName(name: string): void;

Parámetros

name

string

Devoluciones

void