API 参考

FSheetSlicerBuilder

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

Detached Slicer configuration; all dimensions including rowHeight use CSS px. Setters/build do not run commands.

Access

Access through:

Setup

Register @univerjs-pro/sheets-slicer or a preset that includes it. In plugin mode, import @univerjs-pro/sheets-slicer/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs-pro/sheets-slicer

FSheetSlicerBuilder.build

Returns defensive insert/update information without executing any command or copying runtime filtering. Requires a resolved source. Insertion validates names/style/placement at command execution; omitted names are generated uniquely then, and current live names remain valid on update.

TypeScript
build(): ISheetSlicerInfo

Returns

A defensive current value (where applicable), with missing-resource behavior described above.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails.

Examples

TypeScript
const info = builder.build()

Types: ISheetSlicerInfo

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.clearStyle

Stores an own undefined style override in detached settings; insert/update restores the document default. Does not execute a command or change shared cache/filtering.

TypeScript
clearStyle(): this

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.clearStyle()

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setAbsolutePosition

Stores finite absolute Worksheet CSS px coordinates, clearing the detached anchor. No command runs; placement is validated on insert/update.

TypeScript
setAbsolutePosition(x: number, y: number): this

Parameters

  • x — Required. Finite absolute horizontal CSS px coordinate.
  • y — Required. Finite absolute vertical CSS px coordinate.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setAbsolutePosition(100, 80)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setCaption

Stores the detached view caption, not its name or shared source/cache. The caption must be nonempty and at most 32767 characters. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setCaption(caption: string): this

Parameters

  • caption — Required. Nonempty caption, at most 32767 characters; independent of name.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setCaption('Sales')

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setColumnCount

Stores detached button column count to an integer in [1, 20000], without changing shared filtering. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setColumnCount(count: number): this

Parameters

  • count — Required. Integer button column count in [1, 20000].

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setColumnCount(2)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setLockedPosition

Stores detached persisted position-lock flag, not a shared filter or transient gesture state. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setLockedPosition(locked: boolean): this

Parameters

  • locked — Required. Persisted per-view position-lock flag.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setLockedPosition(true)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setName

Stores the detached view name, not its caption or shared source/cache. Names must be nonempty and unique across Workbook Slicers/Timelines (case-insensitive). Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setName(name: string): this

Parameters

  • name — Required. Nonempty Workbook-unique view name (case-insensitive).

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setName('Sales filter')

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setPivotChart

Resolves the Builder original source field ID against a same-Workbook PivotChart without inserting. Linked charts normalize to their owner PivotTable; owned charts retain their owned report connection.

TypeScript
setPivotChart(pivotChart: FSheetPivotChart): this

Parameters

  • pivotChart — Required. Same-Workbook PivotChart source facade.

Returns

This detached Builder for chaining; no command has run.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails. Source replacement through a cast on a prelinked/bound Builder also throws.

Examples

TypeScript
builder.setPivotChart(pivotChart)

Types: FSheetPivotChart

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setPivotChartReference

Resolves the Builder original source field ID against an explicit same-Workbook PivotChart reference. Linked charts normalize to their owner; this does not insert or modify filtering.

TypeScript
setPivotChartReference(reference: { unitId: string; subUnitId: string; pivotChartId: string; }): this

Parameters

  • reference — Required. Explicit same-Workbook source identity.

Returns

This detached Builder for chaining; no command has run.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails. Source replacement through a cast on a prelinked/bound Builder also throws.

Examples

TypeScript
builder.setPivotChartReference({ unitId: 'unit', subUnitId: 'source', pivotChartId: 'chart' })

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setPivotTable

Resolves the Builder original source field ID against a same-Workbook PivotTable, without inserting. Display names/report tableFieldIds are not substitutes for stable source IDs.

TypeScript
setPivotTable(pivotTable: FPivotTable): this

Parameters

  • pivotTable — Required. Same-Workbook PivotTable source facade.

Returns

This detached Builder for chaining; no command has run.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails. Source replacement through a cast on a prelinked/bound Builder also throws.

Examples

TypeScript
builder.setPivotTable(pivotTable)

Types: FPivotTable

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setPivotTableReference

Resolves the Builder original source field ID against an explicit same-Workbook PivotTable reference. Does not insert or mutate filtering.

TypeScript
setPivotTableReference(reference: { unitId: string; subUnitId: string; pivotTableId: string; }): this

Parameters

  • reference — Required. Explicit same-Workbook source identity.

Returns

This detached Builder for chaining; no command has run.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails. Source replacement through a cast on a prelinked/bound Builder also throws.

Examples

TypeScript
builder.setPivotTableReference({ unitId: 'unit', subUnitId: 'source', pivotTableId: 'pivot' })

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setPosition

Stores an A1 or zero-based row/column anchor with CSS px offsets, clearing detached absolute position. No command runs; placement is validated on insert/update.

TypeScript
setPosition(anchor: SheetSlicerAnchorSpec): this

Parameters

  • anchor — Required. A1 cell or zero-based row/column anchor with CSS px offsets.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setPosition('J2')

Types: SheetSlicerAnchorSpec

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setRowHeight

Stores detached item row height in finite positive CSS px, without changing shared filtering. On insert/update, persists Math.round(height * 9525) as a positive unsigned integer EMU (at most 4294967295); reads divide by 9525. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setRowHeight(height: number): this

Parameters

  • height — Required. Finite positive CSS px height (rowHeight converts to rounded EMU).

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setRowHeight(24)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setShowCaption

Stores detached caption visibility without changing its caption or shared filtering. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setShowCaption(visible: boolean): this

Parameters

  • visible — Required. Whether this per-view element is visible.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setShowCaption(true)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setSize

Stores finite positive CSS px size in detached configuration without executing a command. Insert/update validates it; omitted insertion sizes default to 220 x 280 (Slicer) or 420 x 140 (Timeline).

TypeScript
setSize(width: number, height: number): this

Parameters

  • width — Required. Finite positive width in CSS px.
  • height — Required. Finite positive height in CSS px.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setSize(220, 280)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setStartItem

Stores detached zero-based visible member offset to an unsigned integer [0, 4294967295]. This is navigation, not member identity or shared filter selection. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setStartItem(index: number): this

Parameters

  • index — Required. Zero-based order/member offset as described above.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setStartItem(0)

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setStyle

Stores detached style override to an available Workbook builtin/custom style name. Use clearStyle to restore the document default; source/cache/filter are unchanged. Only this detached configuration changes; no command or model write runs. Validation occurs on insert/update.

TypeScript
setStyle(style: string): this

Parameters

  • style — Required. Available Workbook builtin/custom style name.

Returns

This detached Builder for chaining; no command has run.

Examples

TypeScript
builder.setStyle(styleNames[0])

Package: @univerjs-pro/sheets-slicer · Type definitions

FSheetSlicerBuilder.setTableReference

Resolves the Builder field ID as a stable Table column ID on a same-Workbook source sheet. Never accepts a display name/index. Does not insert or modify a model.

TypeScript
setTableReference(reference: { subUnitId: string; tableId: string; }): this

Parameters

  • reference — Required. Explicit same-Workbook source identity.

Returns

This detached Builder for chaining; no command has run.

Throws

If required source/host data is unavailable, input is unsupported, or the documented query/command fails. Source replacement through a cast on a prelinked/bound Builder also throws.

Examples

TypeScript
builder.setTableReference({ subUnitId: 'source', tableId: 'table' })

Package: @univerjs-pro/sheets-slicer · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.