UNPKG

docx

Version:

Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

62 lines (61 loc) 2.98 kB
import { FooterWrapper } from '../../../footer-wrapper'; import { HeaderWrapper } from '../../../header-wrapper'; import { IChangedAttributesProperties } from '../../../track-revision/track-revision'; import { SectionVerticalAlign } from '../../../vertical-align'; import { XmlComponent } from '../../../xml-components'; import { IColumnsAttributes } from './properties/columns'; import { IDocGridAttributesProperties } from './properties/doc-grid'; import { ILineNumberAttributes } from './properties/line-number'; import { IPageBordersOptions } from './properties/page-borders'; import { IPageMarginAttributes } from './properties/page-margin'; import { IPageNumberTypeAttributes } from './properties/page-number'; import { IPageSizeAttributes } from './properties/page-size'; import { PageTextDirectionType } from './properties/page-text-direction'; import { SectionType } from './properties/section-type'; export type IHeaderFooterGroup<T> = { readonly default?: T; readonly first?: T; readonly even?: T; }; export type ISectionPropertiesOptionsBase = { readonly page?: { readonly size?: Partial<IPageSizeAttributes>; readonly margin?: IPageMarginAttributes; readonly pageNumbers?: IPageNumberTypeAttributes; readonly borders?: IPageBordersOptions; readonly textDirection?: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType]; }; readonly grid?: Partial<IDocGridAttributesProperties>; readonly headerWrapperGroup?: IHeaderFooterGroup<HeaderWrapper>; readonly footerWrapperGroup?: IHeaderFooterGroup<FooterWrapper>; readonly lineNumbers?: ILineNumberAttributes; readonly titlePage?: boolean; readonly verticalAlign?: SectionVerticalAlign; readonly column?: IColumnsAttributes; readonly type?: (typeof SectionType)[keyof typeof SectionType]; }; export type ISectionPropertiesChangeOptions = IChangedAttributesProperties & ISectionPropertiesOptionsBase; export type ISectionPropertiesOptions = { readonly revision?: ISectionPropertiesChangeOptions; } & ISectionPropertiesOptionsBase; export declare const sectionMarginDefaults: { TOP: number; RIGHT: number; BOTTOM: number; LEFT: number; HEADER: number; FOOTER: number; GUTTER: number; }; export declare const sectionPageSizeDefaults: { WIDTH: number; HEIGHT: number; ORIENTATION: "portrait"; }; export declare class SectionProperties extends XmlComponent { constructor({ page: { size: { width, height, orientation, code, }, margin: { top, right, bottom, left, header, footer, gutter, }, pageNumbers, borders, textDirection, }, grid: { linePitch, charSpace, type: gridType }, headerWrapperGroup, footerWrapperGroup, lineNumbers, titlePage, verticalAlign, column, type, revision, }?: ISectionPropertiesOptions); private addHeaderFooterGroup; } export declare class SectionPropertiesChange extends XmlComponent { constructor(options: ISectionPropertiesChangeOptions); }