Excel.ValueTypeNotAvailableCellValue interface

表示包含无法序列化的值类型的单元格的值。 例如,#UNKNOWN! 错误,表示此版本的 Excel 不知道的丰富值类型。

注解

API 集:ExcelApi 1.16

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/20-data-types/data-types-error-values.yaml

// Read the fallback properties of a value that Excel can't serialize.
await Excel.run(async (context) => {
  const sheet: Excel.Worksheet = context.workbook.worksheets.getItem("Sample");
  const range: Excel.Range = sheet.getRange("B1");
  range.load("valuesAsJson");
  await context.sync();

  const cellValue: Excel.CellValue = range.valuesAsJson[0][0];
  if (cellValue.type === Excel.CellValueType.notAvailable) {
    const unavailableValue: Excel.ValueTypeNotAvailableCellValue = cellValue;
    console.log("B1 value type:", unavailableValue.type);
    console.log("B1 fallback type:", unavailableValue.basicType);
    console.log("B1 fallback value:", unavailableValue.basicValue);
  } else {
    console.log("B1 value type:", cellValue.type);
    console.log("B1's value type is supported. No unavailable-type fallback was returned.");
  }
});

属性

basicType

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

basicValue

表示对于具有此值的单元格将返回 Range.values 的值。

type

表示此单元格值的类型。

属性详细信息

basicType

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

basicType: RangeValueType | "Boolean" | "Double" | "Error" | "Empty" | "String";

属性值

Excel.RangeValueType | "Boolean" | "Double" | "Error" | "Empty" | "String"

注解

API 集:ExcelApi 1.16

basicValue

表示对于具有此值的单元格将返回 Range.values 的值。

basicValue: boolean | number | string;

属性值

boolean | number | string

注解

API 集:ExcelApi 1.16

type

表示此单元格值的类型。

type: CellValueType.notAvailable | "NotAvailable";

属性值

notAvailable | "NotAvailable"

注解

API 集:ExcelApi 1.16