docxml
Version:
TypeScript (component) library for building and parsing a DOCX file
48 lines (47 loc) • 1.79 kB
TypeScript
import './Row.js';
import './RowAddition.js';
import './RowDeletion.js';
import { type ComponentAncestor, Component, ComponentContext } from '../classes/Component.js';
import { type TableProperties } from '../properties/table-properties.js';
import { type Length } from '../utilities/length.js';
import { TableGridModel } from '../utilities/tables.js';
import { type Row } from './Row.js';
import { type RowAddition } from './RowAddition.js';
import { type RowDeletion } from './RowDeletion.js';
/**
* A type describing the components accepted as children of {@link Table}.
*/
export declare type TableChild = Row | RowAddition | RowDeletion;
/**
* A type describing the props accepted by {@link Table}.
*/
export declare type TableProps = TableProperties & {
columnWidths?: null | Length[];
};
/**
* A component that represents a table.
*/
export declare class Table extends Component<TableProps, TableChild> {
static readonly children: string[];
static readonly mixed: boolean;
/**
* A conceptual description of how the cells, columns, rows and spans of this table make sense.
*
* Exposed so it can be accessed by {@link Row} and {@link Cell} descendants, but not meant
* to be used otherwise.
*/
readonly model: TableGridModel;
constructor(tableProps: TableProps, ...tableChildren: TableChild[]);
/**
* Creates an XML DOM node for this component instance.
*/
toNode(ancestry: ComponentAncestor[]): Promise<Node>;
/**
* Asserts whether or not a given XML node correlates with this component.
*/
static matchesNode(node: Node): boolean;
/**
* Instantiate this component from the XML in an existing DOCX file.
*/
static fromNode(node: Node, context: ComponentContext): Table;
}