Files
docx-js/src/file/paragraph/run/underline.ts

36 lines
1.0 KiB
TypeScript
Raw Normal View History

import { Attributes, XmlComponent } from "@file/xml-components";
import { hexColorValue } from "@util/values";
2016-07-13 00:59:53 +01:00
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;
2019-06-17 01:51:57 +01:00
2021-05-24 17:12:10 +03:00
export class Underline extends XmlComponent {
public constructor(underlineType: (typeof UnderlineType)[keyof typeof UnderlineType] = UnderlineType.SINGLE, color?: string) {
2016-07-13 00:59:53 +01:00
super("w:u");
2018-01-23 01:33:12 +00:00
this.root.push(
new Attributes({
val: underlineType,
2021-05-24 17:12:10 +03:00
color: color === undefined ? undefined : hexColorValue(color),
2018-01-23 01:33:12 +00:00
}),
);
2016-07-13 00:59:53 +01:00
}
}