parent
3a1e94caba
commit
ff03496182
|
@ -0,0 +1,14 @@
|
||||||
|
export class DocProps {
|
||||||
|
_createdAt: string | null = null;
|
||||||
|
_updatedAt: string | null = null;
|
||||||
|
|
||||||
|
createdAt(date: string) {
|
||||||
|
this._createdAt = date;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
updatedAt(date: string) {
|
||||||
|
this._updatedAt = date;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import { Numbering } from "./numbering";
|
||||||
import { BookmarkStart } from "./bookmark-start";
|
import { BookmarkStart } from "./bookmark-start";
|
||||||
import { BookmarkEnd } from "./bookmark-end";
|
import { BookmarkEnd } from "./bookmark-end";
|
||||||
import { Settings } from "./settings";
|
import { Settings } from "./settings";
|
||||||
|
import { DocProps } from "./doc-props";
|
||||||
import { Styles } from "./styles";
|
import { Styles } from "./styles";
|
||||||
import { SectionProperty, PageMargin } from "./section-property";
|
import { SectionProperty, PageMargin } from "./section-property";
|
||||||
import { DocxJSON } from "./json";
|
import { DocxJSON } from "./json";
|
||||||
|
@ -56,6 +57,7 @@ export class Docx {
|
||||||
abstractNumberings: AbstractNumbering[] = [];
|
abstractNumberings: AbstractNumbering[] = [];
|
||||||
numberings: Numbering[] = [];
|
numberings: Numbering[] = [];
|
||||||
settings: Settings = new Settings();
|
settings: Settings = new Settings();
|
||||||
|
docProps: DocProps = new DocProps();
|
||||||
sectionProperty: SectionProperty = new SectionProperty();
|
sectionProperty: SectionProperty = new SectionProperty();
|
||||||
styles = new Styles();
|
styles = new Styles();
|
||||||
|
|
||||||
|
@ -100,6 +102,16 @@ export class Docx {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createdAt(date: string) {
|
||||||
|
this.docProps.createdAt(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
updatedAt(date: string) {
|
||||||
|
this.docProps.updatedAt(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
addDocVar(name: string, val: string) {
|
addDocVar(name: string, val: string) {
|
||||||
this.settings.addDocVar(name, val);
|
this.settings.addDocVar(name, val);
|
||||||
return this;
|
return this;
|
||||||
|
@ -665,6 +677,14 @@ export class Docx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.docProps._createdAt) {
|
||||||
|
docx = docx.created_at(this.docProps._createdAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.docProps._updatedAt) {
|
||||||
|
docx = docx.updated_at(this.docProps._updatedAt);
|
||||||
|
}
|
||||||
|
|
||||||
return docx;
|
return docx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docx-wasm",
|
"name": "docx-wasm",
|
||||||
"version": "0.0.137",
|
"version": "0.0.138",
|
||||||
"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>",
|
||||||
|
|
|
@ -43,6 +43,16 @@ impl Docx {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn created_at(mut self, date: &str) -> Self {
|
||||||
|
self.0.doc_props = self.0.doc_props.created_at(date);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn updated_at(mut self, date: &str) -> Self {
|
||||||
|
self.0.doc_props = self.0.doc_props.updated_at(date);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn doc_id(mut self, id: &str) -> Docx {
|
pub fn doc_id(mut self, id: &str) -> Docx {
|
||||||
self.0 = self.0.doc_id(id);
|
self.0 = self.0.doc_id(id);
|
||||||
self
|
self
|
||||||
|
|
Loading…
Reference in New Issue