export declare type CellBorderStyle = { borderRight?: [string, string]; borderBottom?: [string, string]; borderLeft?: [string, string]; borderTop?: [string, string]; }; export declare type FormattedText = { /** * 文本内容 */ text: string; /** * 是否是粗体 */ bold?: true; /** * 是否是斜体 */ italic?: boolean; /** * 是否添加下划线效果 */ underLine?: boolean; /** * 文本字体大小 */ fontSize?: string; /** * 是否是错误 */ error?: boolean; /** * 是否为提示信息 */ title?: string; /** * 类型。主要用来表达语法高亮区块。 */ type?: string; /** * 是否添加删除线 */ deleteLine?: boolean; /** * 字体 */ fontFamily?: string; /** * 字体颜色 */ color?: string; }; export declare type CustomText = FormattedText; export declare type ParagraphElement = { type: 'paragraph'; children: CustomText[]; }; export interface CellStyle { /** * 边框 */ border?: CellBorderStyle; /** * 水平位置 */ horizontal?: string; /** * 垂直位置 */ vertical?: string; /** * 背景色 */ backgroundColor?: string; } /** * 单个单元格的配置信息 * * @export * @interface Cell */ export interface Cell { /** * 单元格的值 * * @type {string} * @memberof Cell */ value?: ParagraphElement[]; /** * 合并单元格的配置 * 例如 [0,1],表示该单元格占据一行两列,即所有的值加1 * * @type {[number, number]} * @memberof Cell */ merge?: [number, number]; /** * 单元格的样式 * * 比如边框、单元格内容的位置 * * @type {number} * @memberof Cell */ style?: CellStyle; } /** * 同行的所有单元格对象 * * @export * @interface Cells */ export interface Cells { [x: number]: Cell; height?: number; } /** * 行信息集合 */ export declare type RowsInfo = { [x: number]: { cells: Cells; height?: number; }; len: number; }; export declare type ColsType = { [x: number]: { width: number; }; len: number; }; export declare enum PageDirType { HORIZONTAL = "\u6A2A\u5411", VERTICAL = "\u7EB5\u5411" } export declare enum PageSizeType { A3 = "A3", A4 = "A4", A5 = "A5", B4 = "B4", B5 = "B5" } /** * 打印页面配置 */ export interface PageConfig { pageSize: PageSizeType; pageDir: PageDirType; pagePaddingTop: string; pagePaddingBottom: string; pagePaddingLeft: string; pagePaddingRight: string; } /** * 打印内容设置 */ export interface ContentConfig { isShowDefaultTitle: '0' | '1'; isAutoHeight: '0' | '1'; } export interface PrintConfig { pageConfig?: PageConfig; contentConfig?: ContentConfig; } /** * 自定义布局配置对象 * * @export * @interface CustomPrintConfig */ export interface CustomPrintConfig { name?: string; /** * 列配置 * 例如:{ 2:{width: 200}, len: 10} * 表示共有10列, 其中第三列的列宽为200 * * @type {{ [x: number]: { width: number }; len: number }} * @memberof CustomPrintConfig */ cols: ColsType; /** * 行配置 * 例如:{ * 1:{ * cells:{ * 2 :{ * text: 'hello', * merge: [1,1] * } * } * } * len: 10 * } * 表示共用10行,其中第二行第三列的单元格的值为hello, * 合并了2行2列(colspan=2 && rowspan=2) * * @type {{ [x: number]: { cells: Cells }; len: number }} * @memberof CustomPrintConfig */ rows: RowsInfo; /** * 单元格合并的配置集合 * 起始单元格的行和列,结束单元格的行和列组成一个合并单元格信息 * 例如:[[[2,2],[3,3]]] * 表示当前布局只有一个合并的单元格,结束位置为第四行第四列, * 该单元格起始位置为第三行第三列, * * @type {string[]} * @memberof CustomPrintConfig */ merges?: [[number, number], [number, number]][]; /** * 打印设置 */ config?: PrintConfig; }