Files
docx-js/src/file/paragraph/run/underline.ts
Stepan Svechnikov a756a7697c Change all project enums to objects with as const (#2445)
* feat: change all enums to as const objects

* Add word to dictionary

---------

Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2023-12-22 01:25:00 +00:00

36 lines
1.0 KiB
TypeScript

import { Attributes, XmlComponent } from "@file/xml-components";
import { hexColorValue } from "@util/values";
export const UnderlineType = {
SINGLE: "single",
WORDS: "words",
DOUBLE: "double",
THICK: "thick",
DOTTED: "dotted",
DOTTEDHEAVY: "dottedHeavy",
DASH: "dash",
DASHEDHEAVY: "dashedHeavy",
DASHLONG: "dashLong",
DASHLONGHEAVY: "dashLongHeavy",
DOTDASH: "dotDash",
DASHDOTHEAVY: "dashDotHeavy",
DOTDOTDASH: "dotDotDash",
DASHDOTDOTHEAVY: "dashDotDotHeavy",
WAVE: "wave",
WAVYHEAVY: "wavyHeavy",
WAVYDOUBLE: "wavyDouble",
NONE: "none",
} as const;
export class Underline extends XmlComponent {
public constructor(underlineType: (typeof UnderlineType)[keyof typeof UnderlineType] = UnderlineType.SINGLE, color?: string) {
super("w:u");
this.root.push(
new Attributes({
val: underlineType,
color: color === undefined ? undefined : hexColorValue(color),
}),
);
}
}