parent
00aecc91e0
commit
6ed69bdf5d
|
@ -193,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "docx-rs"
|
name = "docx-rs"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"image 0.23.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.23.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"insta 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"insta 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -210,7 +210,7 @@ dependencies = [
|
||||||
name = "docx-wasm"
|
name = "docx-wasm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"docx-rs 0.2.2",
|
"docx-rs 0.2.3",
|
||||||
"wasm-bindgen 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasm-bindgen 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "docx-rs"
|
name = "docx-rs"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
authors = ["bokuweb <bokuweb12@gmail.com>"]
|
authors = ["bokuweb <bokuweb12@gmail.com>"]
|
||||||
repository = "https://github.com/bokuweb/docx-rs"
|
repository = "https://github.com/bokuweb/docx-rs"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
|
@ -126,6 +126,21 @@ export class Docx {
|
||||||
run = run.vanish();
|
run = run.vanish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let f = wasm.createRunFonts();
|
||||||
|
if (r.property.fonts?._ascii) {
|
||||||
|
f = f.ascii(r.property.fonts._ascii);
|
||||||
|
}
|
||||||
|
if (r.property.fonts?._hiAnsi) {
|
||||||
|
f = f.hi_ansi(r.property.fonts._hiAnsi);
|
||||||
|
}
|
||||||
|
if (r.property.fonts?._cs) {
|
||||||
|
f = f.cs(r.property.fonts._cs);
|
||||||
|
}
|
||||||
|
if (r.property.fonts?._eastAsia) {
|
||||||
|
f = f.east_asia(r.property.fonts._eastAsia);
|
||||||
|
}
|
||||||
|
run = run.fonts(f);
|
||||||
|
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,17 +268,17 @@ export class Docx {
|
||||||
|
|
||||||
if (p.property.runProperty.fonts) {
|
if (p.property.runProperty.fonts) {
|
||||||
let f = wasm.createRunFonts();
|
let f = wasm.createRunFonts();
|
||||||
if (p.property.runProperty.fonts.ascii) {
|
if (p.property.runProperty.fonts._ascii) {
|
||||||
f = f.ascii(p.property.runProperty.fonts.ascii);
|
f = f.ascii(p.property.runProperty.fonts._ascii);
|
||||||
}
|
}
|
||||||
if (p.property.runProperty.fonts.hiAnsi) {
|
if (p.property.runProperty.fonts._hiAnsi) {
|
||||||
f = f.hi_ansi(p.property.runProperty.fonts.hiAnsi);
|
f = f.hi_ansi(p.property.runProperty.fonts._hiAnsi);
|
||||||
}
|
}
|
||||||
if (p.property.runProperty.fonts.cs) {
|
if (p.property.runProperty.fonts._cs) {
|
||||||
f = f.cs(p.property.runProperty.fonts.cs);
|
f = f.cs(p.property.runProperty.fonts._cs);
|
||||||
}
|
}
|
||||||
if (p.property.runProperty.fonts.eastAsia) {
|
if (p.property.runProperty.fonts._eastAsia) {
|
||||||
f = f.east_asia(p.property.runProperty.fonts.eastAsia);
|
f = f.east_asia(p.property.runProperty.fonts._eastAsia);
|
||||||
}
|
}
|
||||||
paragraph = paragraph.fonts(f);
|
paragraph = paragraph.fonts(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,32 @@ export type RunProperty = {
|
||||||
fonts?: RunFonts;
|
fonts?: RunFonts;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RunFonts = {
|
export class RunFonts {
|
||||||
ascii?: string;
|
_ascii?: string;
|
||||||
hiAnsi?: string;
|
_hiAnsi?: string;
|
||||||
eastAsia?: string;
|
_eastAsia?: string;
|
||||||
cs?: string;
|
_cs?: string;
|
||||||
};
|
|
||||||
|
ascii(f: string) {
|
||||||
|
this._ascii = f;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
hiAnsi(f: string) {
|
||||||
|
this._hiAnsi = f;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
cs(f: string) {
|
||||||
|
this._cs = f;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
eastAsia(f: string) {
|
||||||
|
this._eastAsia = f;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Run {
|
export class Run {
|
||||||
children: RunChild[] = [];
|
children: RunChild[] = [];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docx-wasm",
|
"name": "docx-wasm",
|
||||||
"version": "0.0.77",
|
"version": "0.0.80",
|
||||||
"main": "dist/node/index.js",
|
"main": "dist/node/index.js",
|
||||||
"browser": "dist/web/index.js",
|
"browser": "dist/web/index.js",
|
||||||
"author": "bokuweb <bokuweb12@gmail.com>",
|
"author": "bokuweb <bokuweb12@gmail.com>",
|
||||||
|
|
Loading…
Reference in New Issue