API 参考

FDocumentQuote

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

Facade object for a single docs quote block.

Access

Access through:

Example

TypeScript
const fDocument = univerAPI.getActiveDocument()const quotes = fDocument.getQuotes()console.log(quotes)const quote = fDocument.findQuoteByText('Decision')console.log(quote?.getText())if (quote) {  console.log(quote.getStyle())  quote.setStyle({ lineColor: '#5B5FC7', textColor: '#242424' })  console.log(quote.describe())}

Setup

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

@univerjs-pro/docs-quote

FDocumentQuote.describe

Returns an agent-friendly description of the quote.

TypeScript
describe(): IDocsQuoteInfo | null

Returns

The quote id, range, text, and style, or null if it no longer exists.

Examples

TypeScript
const fDocument = univerAPI.getActiveDocument()const quote = fDocument.findQuoteByText('Decision')if (quote) {  console.log(quote.describe())}

Types: IDocsQuoteInfo

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.getId

Returns the quote block id.

TypeScript
getId(): string

Returns

The quote block range id.

Examples

const fDocument = univerAPI.getActiveDocument(); const quotes = fDocument.getQuotes();

// Get the id of the first quote. if (quotes.length > 0) { const quote = quotes[0]; console.log(quote.getId()); }

text
**Package:** [`@univerjs-pro/docs-quote`](/reference/packages/plugins/univerjs-pro/docs-quote) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)### `FDocumentQuote.getRange` [#getrange]Returns the quote block range in the document data stream.```typescriptgetRange(): IDocsQuoteRange | null

Returns

The quote range, or null if it no longer exists.

Examples

TypeScript
const fDocument = univerAPI.getActiveDocument()const quotes = fDocument.getQuotes()// Get the range of the first quote.if (quotes.length > 0) {  const quote = quotes[0]  console.log(quote.getRange())}

Types: IDocsQuoteRange

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.getStyle

Returns both user-editable Quote colors as one serializable object.

TypeScript
getStyle(): IDocsQuoteStyle

Returns

The current left-line color and first effective text color.

Examples

TypeScript
const quote = univerAPI.getActiveDocument()?.findQuoteByText('Decision')if (!quote) {  throw new Error('Quote not found')}console.log(JSON.stringify(quote.getStyle(), null, 2))

Types: IDocsQuoteStyle

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.getText

Returns plain text inside the quote.

TypeScript
getText(): string

Returns

The quote text with block tokens removed.

Examples

TypeScript
const fDocument = univerAPI.getActiveDocument()const quote = fDocument.findQuoteByText('Decision')if (quote) {  console.log(quote.getText())}

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.remove

Removes this quote block and its content.

TypeScript
remove(): boolean

Returns

Whether the quote block was removed.

Examples

TypeScript
const fDocument = univerAPI.getActiveDocument()const quote = fDocument.findQuoteByText('Decision')if (quote) {  const success = quote.remove()  console.log(success)}

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.setLineColor

Sets the color of the Quote's left rule through the Quote style command.

TypeScript
setLineColor(lineColor: string): boolean

Parameters

  • lineColor — Required.

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.setStyle

Updates one or both Quote colors as one command and one undo history entry. Omitted colors retain their current values.

TypeScript
setStyle(style: Partial<IDocsQuoteStyle>): boolean

Parameters

  • style — Required. The left-line color, text color, or both.

Returns

Whether the style command succeeded.

Examples

TypeScript
const quote = univerAPI.getActiveDocument()?.findQuoteByText('Decision')if (!quote) {  throw new Error('Quote not found')}const updated = quote.setStyle({  lineColor: '#5B5FC7',  textColor: '#242424',})console.log({ updated, style: quote.getStyle() })

Types: Partial · IDocsQuoteStyle

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.setTextColor

Applies one text color to all text in this Quote through the Quote style command.

TypeScript
setTextColor(textColor: string): boolean

Parameters

  • textColor — Required.

Package: @univerjs-pro/docs-quote · Type definitions

FDocumentQuote.unwrap

Unwraps this quote by removing only the quote block formatting.

TypeScript
unwrap(): boolean

Returns

Whether the quote block formatting was removed.

Examples

TypeScript
const fDocument = univerAPI.getActiveDocument()const quote = fDocument.findQuoteByText('Decision')if (quote) {  const success = quote.unwrap()  console.log(success)}

Package: @univerjs-pro/docs-quote · Type definitions

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.