UNPKG

docxml

Version:

TypeScript (component) library for building and parsing a DOCX file

64 lines (63 loc) 2.86 kB
import './BookmarkRangeEnd.js'; import './BookmarkRangeStart.js'; import './Comment.js'; import './CommentRangeEnd.js'; import './CommentRangeStart.js'; import './Field.js'; import './Hyperlink.js'; import './Text.js'; import './TextAddition.js'; import './TextDeletion.js'; import { type Hyperlink } from '../../mod.js'; import { type ComponentAncestor, Component, ComponentContext } from '../classes/Component.js'; import { type ParagraphProperties } from '../properties/paragraph-properties.js'; import { type SectionProperties } from '../properties/section-properties.js'; import { type BookmarkRangeEnd } from './BookmarkRangeEnd.js'; import { type BookmarkRangeStart } from './BookmarkRangeStart.js'; import { type Comment } from './Comment.js'; import { type CommentRangeEnd } from './CommentRangeEnd.js'; import { type CommentRangeStart } from './CommentRangeStart.js'; import { type Field } from './Field.js'; import { type Text } from './Text.js'; import { type TextAddition } from './TextAddition.js'; import { type TextDeletion } from './TextDeletion.js'; /** * A type describing the components accepted as children of {@link Paragraph}. */ export declare type ParagraphChild = Text | TextAddition | TextDeletion | CommentRangeStart | CommentRangeEnd | Comment | BookmarkRangeStart | BookmarkRangeEnd | Hyperlink | Field; /** * A type describing the props accepted by {@link Paragraph}. * * The "style" option, which is part of both paragraph- and text properties, is always * set to the _paragraph_ style -- the _text_ style is ignored. */ export declare type ParagraphProps = ParagraphProperties; /** * A component that represents a paragraph in your DOCX document, which is one of the most * widely used components and the most likely to contain a style rule or other. * * A paragraph is a block-level element and contains text and inlines, see also {@link Text}. */ export declare class Paragraph extends Component<ParagraphProps, ParagraphChild> { #private; static readonly children: string[]; static readonly mixed: boolean; /** * Set properties to the section that this paragraph is supposed to represent. Not intended to be * called manually. Only here because OOXML somehow decided that a section is defined in the last * paragraph of it, rather than as an element of its own. */ setSectionProperties(properties?: SectionProperties | null): void; /** * 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): Paragraph; }