docxml
Version:
TypeScript (component) library for building and parsing a DOCX file
42 lines (41 loc) • 1.8 kB
TypeScript
import './Paragraph.js';
import './Table.js';
import { type ComponentAncestor, Component, ComponentContext, ComponentNodes } from '../classes/Component.js';
import { SectionProperties } from '../properties/section-properties.js';
import { type BookmarkRangeEnd } from './BookmarkRangeEnd.js';
import { type BookmarkRangeStart } from './BookmarkRangeStart.js';
import { Paragraph } from './Paragraph.js';
import { Table } from './Table.js';
/**
* A type describing the components accepted as children of {@link Section}.
*/
export declare type SectionChild = Paragraph | Table | BookmarkRangeStart | BookmarkRangeEnd;
export declare const sectionChildComponentNames: string[];
/**
* A type describing the props accepted by {@link Section}.
*/
export declare type SectionProps = SectionProperties;
/**
* A component that represents a DOCX section, which could have its own page sizing options and so
* on.
*
* In normal OOXML this information belongs at either the end of the document, or inside the
* formatting options of the last paragraph belonging to that section. This component will smooth
* that over in such a way that you can simply put `<Paragraph>` (etc.) inside `<Section>`.
*/
export declare class Section extends Component<SectionProps, SectionChild> {
static readonly children: string[];
static readonly mixed: boolean;
/**
* Creates an XML DOM node for this component instance.
*/
toNode(ancestry: ComponentAncestor[]): Promise<ComponentNodes>;
/**
* 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): Section;
}