feat(core): add headers and footers styles

This commit is contained in:
syy11cn 2022-05-29 19:12:43 +08:00
parent 0e573dbd6a
commit 67a935ed47
2 changed files with 32 additions and 4 deletions

View File

@ -24,8 +24,6 @@
}, },
"dependencies": { "dependencies": {
"docx": "^7.3.0", "docx": "^7.3.0",
"file-saver": "^2.0.5",
"image-size": "^1.0.1",
"resolve-from": "^5.0.0", "resolve-from": "^5.0.0",
"yargs": "^17.4.1" "yargs": "^17.4.1"
} }

View File

@ -42,7 +42,7 @@ export const defaultConfig: IMarkdownReportConfig = {
// Code. // Code.
{ {
id: StyleId.code, id: StyleId.code,
name: StyleId.code, name: StyleName.code,
basedOn: StyleId.normal, basedOn: StyleId.normal,
run: { run: {
size: ptToHalfPt(10), size: ptToHalfPt(10),
@ -62,6 +62,36 @@ export const defaultConfig: IMarkdownReportConfig = {
alignment: AlignmentType.LEFT, alignment: AlignmentType.LEFT,
}, },
}, },
// Header.
{
id: StyleId.header,
name: StyleName.header,
basedOn: StyleId.normal,
run: {
size: ptToHalfPt(10.5),
},
paragraph: {
indent: {
firstLine: 0,
},
alignment: AlignmentType.CENTER,
spacing: {
after: 0,
line: lineHeightTimesToNumber(1),
},
},
},
// Footer.
{
id: StyleId.footer,
name: StyleName.footer,
basedOn: StyleId.header,
paragraph: {
spacing: {
line: lineHeightTimesToNumber(3),
},
},
},
// Heading 1. // Heading 1.
{ {
id: StyleId.h1, id: StyleId.h1,
@ -77,7 +107,7 @@ export const defaultConfig: IMarkdownReportConfig = {
}, },
paragraph: { paragraph: {
spacing: { spacing: {
before: ptToTwip(30), // before: ptToTwip(30),
after: ptToTwip(30), after: ptToTwip(30),
}, },
alignment: AlignmentType.CENTER, alignment: AlignmentType.CENTER,