Fix run props (#29)

* fix: run

* fix:table

* fix: package.json
main
bokuweb 2020-01-31 01:14:48 +09:00 committed by GitHub
parent 2c8bbbb43f
commit 1df5e25523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import("../js").then(w => {
.bold()
.highlight("yellow")
.color("FF0000")
.size(40)
)
)
.build();

View File

@ -176,7 +176,7 @@ export class Docx {
break;
}
case "hanging": {
paragraph = paragraph.align(wasm.SpecialIndentKind.Hanging);
kind = wasm.SpecialIndentKind.Hanging;
break;
}
}
@ -203,6 +203,7 @@ export class Docx {
const cell = this.buildCell(c);
row = row.add_cell(cell);
});
table = table.add_row(row);
});
table = table.set_grid(new Uint32Array(t.grid));

View File

@ -40,37 +40,37 @@ export class Run {
}
size(size: number) {
this.property.size = size;
this.property = { ...this.property, size };
return this;
}
color(color: string) {
this.property.color = color;
this.property = { ...this.property, color };
return this;
}
highlight(color: string) {
this.property.highlight = color;
this.property = { ...this.property, highlight: color };
return this;
}
bold() {
this.property.bold = true;
this.property = { ...this.property, bold: true };
return this;
}
italic() {
this.property.italic = true;
this.property = { ...this.property, italic: true };
return this;
}
underline(type: string) {
this.property.underline = type;
this.property = { ...this.property, underline: type };
return this;
}
vanish() {
this.property.vanish = true;
this.property = { ...this.property, vanish: true };
return this;
}
}

View File

@ -10,7 +10,7 @@ export type CellProperty = {
export class TableCell {
children: Paragraph[] = [];
property: CellProperty;
property: CellProperty = {};
addParagraph(p: Paragraph) {
this.children.push(p);

View File

@ -11,7 +11,7 @@ export type TableProperty = {
export class Table {
rows: TableRow[] = [];
grid: number[] = [];
property: TableProperty;
property: TableProperty = {};
addRow(row: TableRow) {
this.rows.push(row);

View File

@ -1,6 +1,6 @@
{
"name": "docx-wasm",
"version": "0.0.11",
"version": "0.0.19",
"main": "dist/index.js",
"author": "bokuweb <bokuweb12@gmail.com>",
"license": "MIT",

View File

@ -14,5 +14,6 @@
"esModuleInterop": true,
"outDir": "dist",
"declaration": true
}
},
"include": ["js"]
}