import type { ISlideTableBorder, ISlideTableCell, ISlideTableCellStyle, ISlideTableFill } from '@univerjs-pro/slides-table'; import type { IDocumentData } from '@univerjs/core'; import type { FSlideTable } from './f-slide-table'; /** * Facade object for a single slide table cell. * * @example * ```ts * import '@univerjs-pro/slides-table/facade'; * * const fPresentation = univerAPI.getActivePresentation(); * const table = fPresentation?.getActiveSlide()?.getTables()[0]; * const cell = table?.getCell(0, 0); * cell?.setText('Ready'); * cell?.setBackgroundColor('#E8F1FF'); * ``` */ export declare class FSlideTableCell { private readonly _table; private readonly _row; private readonly _column; constructor(_table: FSlideTable, _row: number, _column: number); /** * Return the parent table facade. * * @returns {FSlideTable} The parent table. * * @example * ```ts * const cell = table.getCell(0, 0); * console.log(cell?.getTable().getTableId()); * ``` */ getTable(): FSlideTable; /** * Return the zero-based row index. * * @returns {number} The row index. * * @example * ```ts * const cell = table.getCell(1, 0); * console.log(cell?.getRowIndex()); * ``` */ getRowIndex(): number; /** * Return the zero-based column index. * * @returns {number} The column index. * * @example * ```ts * const cell = table.getCell(0, 1); * console.log(cell?.getColumnIndex()); * ``` */ getColumnIndex(): number; /** * Return the raw cell snapshot. * * @returns {ISlideTableCell | null} The cell snapshot, or `null` when the cell does not exist. * * @example * ```ts * const cell = table.getCell(0, 0); * console.log(cell?.getData()?.rowSpan); * ``` */ getData(): ISlideTableCell | null; /** * Return the plain text in this cell. * * @returns {string} The plain cell text. * * @example * ```ts * const cell = table.getCell(0, 0); * console.log(cell?.getText()); * ``` */ getText(): string; /** * Return the rich text document data in this cell. * * @returns {IDocumentData | undefined} The cell rich text data. * * @example * ```ts * const cell = table.getCell(0, 0); * console.log(cell?.getTextData()?.body?.dataStream); * ``` */ getTextData(): IDocumentData | undefined; /** * Return the cell style. * * @returns {ISlideTableCellStyle | undefined} The cell style. * * @example * ```ts * const cell = table.getCell(0, 0); * console.log(cell?.getStyle()?.fill); * ``` */ getStyle(): ISlideTableCellStyle | undefined; /** * Replace this cell with plain text. * * @param {string} text The new plain text. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * const cell = table.getCell(0, 0); * cell?.setText('Ready'); * ``` */ setText(text: string): boolean; /** * Replace this cell with rich text document data. * * @param {IDocumentData} textData The rich text document data. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * const textData = { * id: 'cell-doc', * body: { dataStream: 'Ready\r\n', paragraphs: [{ startIndex: 0 }], textRuns: [] }, * documentStyle: {}, * }; * table.getCell(0, 0)?.setTextData(textData); * ``` */ setTextData(textData: IDocumentData): boolean; /** * Merge supported style fields into this cell. * * @param {ISlideTableCellStyle} style The style patch. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.setStyle({ * verticalAlign: 'middle', * fill: { color: '#E8F1FF', alpha: 1 }, * }); * ``` */ setStyle(style: ISlideTableCellStyle): boolean; /** * Set the cell fill. * * @param {ISlideTableFill | undefined} fill The fill, or `undefined` to clear it. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.setFill({ color: '#E8F1FF', alpha: 1 }); * ``` */ setFill(fill?: ISlideTableFill): boolean; /** * Set a solid background color for this cell. * * @param {string} color The background color. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.setBackgroundColor('#E8F1FF'); * ``` */ setBackgroundColor(color: string): boolean; /** * Clear this cell's fill. * * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.clearBackground(); * ``` */ clearBackground(): boolean; /** * Apply borders to this cell. * * @param {ISlideTableBorder} border The border style. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.setBorder({ color: '#111827', width: 1, dash: 'solid' }); * ``` */ setBorder(border: ISlideTableBorder): boolean; /** * Merge this cell with a rectangular span starting at this cell. * * @param {number} rowSpan The number of rows to include. * @param {number} columnSpan The number of columns to include. * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.mergeTo(2, 2); * ``` */ mergeTo(rowSpan: number, columnSpan: number): boolean; /** * Unmerge the merged range containing this cell. * * @returns {boolean} Whether the command succeeded. * * @example * ```ts * table.getCell(0, 0)?.unmerge(); * ``` */ unmerge(): boolean; }