# FDocumentQuote

- Human documentation: [https://docs.univer.ai/reference/facade/document-quote](https://docs.univer.ai/reference/facade/document-quote)

- Agent Markdown: [https://docs.univer.ai/reference/facade/document-quote.md](https://docs.univer.ai/reference/facade/document-quote.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/document-quote.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/document-quote.mdx)

---

Facade object for a single docs quote block.

## Access

Access through:

* [`FDocument.getQuotes()`](https://docs.univer.ai/reference/facade/document.md#getquotes)
* [`FDocument.getQuote()`](https://docs.univer.ai/reference/facade/document.md#getquote)
* [`FDocument.getQuoteAt()`](https://docs.univer.ai/reference/facade/document.md#getquoteat)
* [`FDocument.findQuoteByText()`](https://docs.univer.ai/reference/facade/document.md#findquotebytext)
* [`FDocument.findQuotes()`](https://docs.univer.ai/reference/facade/document.md#findquotes)
* [`FDocument.insertQuote()`](https://docs.univer.ai/reference/facade/document.md#insertquote)

## Example

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) 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](https://docs.univer.ai/guides/docs/getting-started/facade.md).

## `@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**

```ts
const fDocument = univerAPI.getActiveDocument()
const quote = fDocument.findQuoteByText('Decision')

if (quote) {
  console.log(quote.describe())
}
```

**Types:** [`IDocsQuoteInfo`](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/types.d.ts)

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `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());
}

````

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [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.

```typescript
getRange(): IDocsQuoteRange | null
````

**Returns**

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

**Examples**

```ts
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`](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/types.d.ts)

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `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**

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

**Types:** [`IDocsQuoteStyle`](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/types.d.ts)

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `FDocumentQuote.getText`

Returns plain text inside the quote.

```typescript
getText(): string
```

**Returns**

The quote text with block tokens removed.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const quote = fDocument.findQuoteByText('Decision')

if (quote) {
  console.log(quote.getText())
}
```

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `FDocumentQuote.remove`

Removes this quote block and its content.

```typescript
remove(): boolean
```

**Returns**

Whether the quote block was removed.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const quote = fDocument.findQuoteByText('Decision')

if (quote) {
  const success = quote.remove()
  console.log(success)
}
```

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `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**

```ts
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`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`IDocsQuoteStyle`](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/types.d.ts)

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)

### `FDocumentQuote.unwrap`

Unwraps this quote by removing only the quote block formatting.

```typescript
unwrap(): boolean
```

**Returns**

Whether the quote block formatting was removed.

**Examples**

```ts
const fDocument = univerAPI.getActiveDocument()
const quote = fDocument.findQuoteByText('Decision')

if (quote) {
  const success = quote.unwrap()
  console.log(success)
}
```

**Package:** [`@univerjs-pro/docs-quote`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/docs-quote.md) · [Type definitions](https://unpkg.com/@univerjs-pro/docs-quote@1.0.0-rc.0/lib/types/facade/f-document-quote.d.ts)
