2022-10-26 23:09:36 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
|
|
|
import { uniqueNumericId } from "@util/convenience-functions";
|
|
|
|
|
|
|
|
class DocPropertiesAttributes extends XmlAttributeComponent<{
|
|
|
|
readonly id?: number;
|
|
|
|
readonly name?: string;
|
|
|
|
readonly description?: string;
|
|
|
|
readonly title?: string;
|
|
|
|
}> {
|
|
|
|
protected readonly xmlKeys = {
|
|
|
|
id: "id",
|
|
|
|
name: "name",
|
|
|
|
description: "descr",
|
|
|
|
title: "title",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DocPropertiesOptions {
|
|
|
|
readonly name: string;
|
|
|
|
readonly description: string;
|
|
|
|
readonly title: string;
|
|
|
|
}
|
2018-01-16 01:31:47 +00:00
|
|
|
|
|
|
|
export class DocProperties extends XmlComponent {
|
2022-10-26 23:09:36 +01:00
|
|
|
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
|
2018-01-16 01:31:47 +00:00
|
|
|
super("wp:docPr");
|
|
|
|
|
2018-01-23 01:33:12 +00:00
|
|
|
this.root.push(
|
|
|
|
new DocPropertiesAttributes({
|
2022-10-26 23:09:36 +01:00
|
|
|
id: uniqueNumericId(),
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
title,
|
2018-01-23 01:33:12 +00:00
|
|
|
}),
|
|
|
|
);
|
2018-01-16 01:31:47 +00:00
|
|
|
}
|
|
|
|
}
|