feat: add page break option

This commit is contained in:
Hufe921
2023-08-31 21:44:45 +08:00
parent 3c10be26fb
commit ec627dc407
11 changed files with 47 additions and 10 deletions
+9 -7
View File
@@ -1,19 +1,18 @@
import { DeepRequired } from '../../../interface/Common'
import { IEditorOption } from '../../../interface/Editor'
import { IRowElement } from '../../../interface/Row'
import { I18n } from '../../i18n/I18n'
import { Draw } from '../Draw'
export class PageBreakParticle {
static readonly font: string = 'Yahei'
static readonly fontSize: number = 12
static readonly displayName: string = '分页符'
static readonly lineDash: number[] = [3, 1]
private draw: Draw
private options: Required<IEditorOption>
private options: DeepRequired<IEditorOption>
private i18n: I18n
constructor(draw: Draw) {
this.draw = draw
this.options = draw.getOptions()
this.i18n = draw.getI18n()
}
public render(
@@ -22,7 +21,10 @@ export class PageBreakParticle {
x: number,
y: number
) {
const { font, fontSize, displayName, lineDash } = PageBreakParticle
const {
pageBreak: { font, fontSize, lineDash }
} = this.options
const displayName = this.i18n.t('pageBreak.displayName')
const { scale, defaultRowMargin } = this.options
const size = fontSize * scale
const elementWidth = element.width!
+4 -1
View File
@@ -69,5 +69,8 @@
"frame": {
"header": "Header",
"footer": "Footer"
},
"pageBreak": {
"displayName": "Page Break"
}
}
}
+4 -1
View File
@@ -69,5 +69,8 @@
"frame": {
"header": "页眉",
"footer": "页脚"
},
"pageBreak": {
"displayName": "分页符"
}
}
}