Excel.ArrayCellValue interface

表示单元格值的 2D 数组。

注解

API 集:ExcelApi 1.16

示例

const sheet = context.workbook.worksheets.getActiveWorksheet();

// This `EntityCellValue` contains an `ArrayCellValue` with two products and their prices.
const myEntity: Excel.EntityCellValue = {
    type: Excel.CellValueType.entity,
    text: "Product Catalog",
    properties: {
        items: {
            type: Excel.CellValueType.array, /* ArrayCellValue */
            elements: [[
                {
                    type: Excel.CellValueType.string,
                    basicValue: "Bicycle"
                },
                {
                    type: Excel.CellValueType.double,
                    basicValue: 300,
                    numberFormat: "$* #,##0.00",
                }
            ],
            [
                {
                    type: Excel.CellValueType.string,
                    basicValue: "Helmet"
                },
                {
                    type: Excel.CellValueType.double,
                    basicValue: 25,
                    numberFormat: "$* #,##0.00",
                }           
            ]],
            basicType: Excel.RangeValueType.error,
            basicValue: "#VALUE!"
        }
    },
    basicType: Excel.RangeValueType.error, // A read-only property. Used as a fallback in incompatible scenarios.
    basicValue: "#VALUE!" // A read-only property. Used as a fallback in incompatible scenarios.
};

sheet.getCell(0,0).valuesAsJson = [[myEntity]];

属性

basicType

表示将为具有此值的单元格返回 Range.valueTypes 的值。

basicValue

表示将为具有此值的单元格返回 Range.values 的值。 通过 valuesAsJson 属性访问时,此字符串值与 en-US 区域设置一致。 通过 valuesAsJsonLocal 属性访问时,此字符串值与用户的显示区域设置一致。

elements

表示数组的元素。 不能直接包含 ArrayCellValue

referencedValues

表示 在 中 ArrayCellValue.elements引用的单元格值。

type

表示此单元格值的类型。

属性详细信息

basicType

表示将为具有此值的单元格返回 Range.valueTypes 的值。

basicType?: RangeValueType.error | "Error";

属性值

error | "Error"

注解

API 集:ExcelApi 1.16

basicValue

表示将为具有此值的单元格返回 Range.values 的值。 通过 valuesAsJson 属性访问时,此字符串值与 en-US 区域设置一致。 通过 valuesAsJsonLocal 属性访问时,此字符串值与用户的显示区域设置一致。

basicValue?: "#VALUE!" | string;

属性值

"#VALUE!" | string

注解

API 集:ExcelApi 1.16

elements

表示数组的元素。 不能直接包含 ArrayCellValue

elements: CellValue[][];

属性值

注解

API 集:ExcelApi 1.16

referencedValues

表示 在 中 ArrayCellValue.elements引用的单元格值。

referencedValues?: ReferencedValue[];

属性值

注解

API 集:ExcelApi 1.16

type

表示此单元格值的类型。

type: CellValueType.array | ReferenceValueType.array | "Array";

属性值

array | array | "Array"

注解

API 集:ExcelApi 1.16