made use of xml unit component

This commit is contained in:
Dolan Miu
2016-05-01 23:48:45 +01:00
parent 1329a8a1e0
commit 76a10529ff

View File

@ -1,13 +1,10 @@
import {XmlUnitComponent} from "../docx/xml-components";
import {XmlComponent} from "../docx/xml-components"; import {XmlComponent} from "../docx/xml-components";
import {DocumentAttributes} from "../docx/document/document-attributes"; import {DocumentAttributes} from "../docx/document/document-attributes";
abstract class Component extends XmlComponent { abstract class Component extends XmlUnitComponent {
protected createNullBlockOrValue(value: string): any { protected createNullBlockOrValue(value: string): any {
if (value === undefined) {
return [{}];
} else {
return value; return value;
}
//return null; //return null;
} }
} }
@ -15,7 +12,7 @@ export class Title extends Component {
constructor(value: string) { constructor(value: string) {
super("dc:title"); super("dc:title");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -23,7 +20,7 @@ export class Subject extends Component {
constructor(value: string) { constructor(value: string) {
super("dc:subject"); super("dc:subject");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -31,7 +28,7 @@ export class Creator extends Component {
constructor(value: string) { constructor(value: string) {
super("dc:creator"); super("dc:creator");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -39,7 +36,7 @@ export class Keywords extends Component {
constructor(value: string) { constructor(value: string) {
super("cp:keywords"); super("cp:keywords");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -47,7 +44,7 @@ export class Description extends Component {
constructor(value: string) { constructor(value: string) {
super("dc:description"); super("dc:description");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -55,7 +52,7 @@ export class LastModifiedBy extends Component {
constructor(value: string) { constructor(value: string) {
super("cp:lastModifiedBy"); super("cp:lastModifiedBy");
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }
@ -64,7 +61,7 @@ export class Revision extends Component {
constructor(value: string) { constructor(value: string) {
super("cp:revision"); super("cp:revision");
var revision = this.createNullBlockOrValue(value); var revision = this.createNullBlockOrValue(value);
this.root.push(this.createNullBlockOrValue(value)); this.root = this.createNullBlockOrValue(value);
} }
} }