API 参考

ICellData

本 API 页面目前提供英文正文。代码签名与标识符不随界面语言变化。

The stored content and formatting of one cell. Use v for plain values, f for formulas, p for rich text, and s for styles. Pass cell data to FRange.setValue or setValues.

TypeScript
import type { ICellData } from '@univerjs/core'import { CellValueType } from '@univerjs/core'const amount: ICellData = { v: 42, t: CellValueType.NUMBER }const formula: ICellData = { f: '=SUM(A1:A5)' }const label: ICellData = { v: '00123', t: CellValueType.FORCE_STRING }

Import

TypeScript
import type { ICellData } from '@univerjs/core'

Definition

TypeScript
interface ICellData {  p?: Nullable<IDocumentData>  s?: Nullable<IStyleData | string>  v?: Nullable<CellValue>  t?: Nullable<CellValueType>  f?: Nullable<string>  ref?: Nullable<string>  xf?: Nullable<string>  si?: Nullable<string>  custom?: CustomData}

Fields

p

Optional · Nullable<IDocumentData>

Rich text stored as a document snapshot. Plain values use v instead.

s

Optional · Nullable<string | IStyleData>

An inline cell style or a style ID from IWorkbookData.styles.

v

Optional · Nullable<CellValue>

The plain cell value: a string, number, or boolean. Use null to clear the value.

t

Optional · Nullable<CellValueType>

The value type. Univer normally infers it; use CellValueType.FORCE_STRING to keep numeric-looking text as text.

f

Optional · Nullable<string>

A formula beginning with =, such as =SUM(A1:B4).

ref

Optional · Nullable<string>

If the formula is a formula array, this field is used to store the referencing range.

xf

Optional · Nullable<string>

New Excel formulas need to add prefixes for differentiation, e.g., _xlfn._xlws. _xlfn. _xlws. _xludf.

si

Optional · Nullable<string>

Id of the formula.

custom

Optional · CustomData

User stored custom fields.

Package: @univerjs/core · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.