Files
docx-js/src/file/custom-properties/custom-property.ts
dependabot[bot] 2381ba8a05 build(deps-dev): bump eslint from 8.57.1 to 9.13.0 (#2792)
* build(deps-dev): bump eslint from 8.57.1 to 9.13.0

Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade EsLint

* Fix all new lint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-21 03:57:15 +01:00

30 lines
850 B
TypeScript

import { XmlComponent } from "@file/xml-components";
import { CustomPropertyAttributes } from "./custom-property-attributes";
export type ICustomPropertyOptions = {
readonly name: string;
readonly value: string;
};
export class CustomProperty extends XmlComponent {
public constructor(id: number, properties: ICustomPropertyOptions) {
super("property");
this.root.push(
new CustomPropertyAttributes({
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
pid: id.toString(),
name: properties.name,
}),
);
this.root.push(new CustomPropertyValue(properties.value));
}
}
export class CustomPropertyValue extends XmlComponent {
public constructor(value: string) {
super("vt:lpwstr");
this.root.push(value);
}
}