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

74 lines
2.3 KiB
TypeScript
Raw Normal View History

import { hexColorValue, signedTwipsMeasureValue } from "file/values";
import { Attributes, XmlComponent } from "file/xml-components";
2020-05-22 12:22:45 +08:00
2018-09-19 18:41:55 -03:00
export class CharacterSpacing extends XmlComponent {
constructor(value: number | string) {
2018-09-19 18:41:55 -03:00
super("w:spacing");
this.root.push(
new Attributes({
val: signedTwipsMeasureValue(value),
2018-01-23 01:33:12 +00:00
}),
);
2016-05-07 20:40:18 +01:00
}
}
// <xsd:complexType name="CT_Color">
// <xsd:attribute name="val" type="ST_HexColor" use="required"/>
// <xsd:attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
// <xsd:attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
// <xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
// </xsd:complexType>
2016-05-07 20:40:18 +01:00
export class Color extends XmlComponent {
constructor(color: string) {
super("w:color");
2018-01-23 01:33:12 +00:00
this.root.push(
new Attributes({
val: hexColorValue(color),
2018-07-24 18:52:45 +03:00
}),
);
}
2018-07-25 15:02:58 +03:00
}
2019-08-05 13:42:45 +03:00
// <xsd:simpleType name="ST_HighlightColor">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="black"/>
// <xsd:enumeration value="blue"/>
// <xsd:enumeration value="cyan"/>
// <xsd:enumeration value="green"/>
// <xsd:enumeration value="magenta"/>
// <xsd:enumeration value="red"/>
// <xsd:enumeration value="yellow"/>
// <xsd:enumeration value="white"/>
// <xsd:enumeration value="darkBlue"/>
// <xsd:enumeration value="darkCyan"/>
// <xsd:enumeration value="darkGreen"/>
// <xsd:enumeration value="darkMagenta"/>
// <xsd:enumeration value="darkRed"/>
// <xsd:enumeration value="darkYellow"/>
// <xsd:enumeration value="darkGray"/>
// <xsd:enumeration value="lightGray"/>
// <xsd:enumeration value="none"/>
// </xsd:restriction>
// </xsd:simpleType>
2019-08-05 13:42:45 +03:00
export class Highlight extends XmlComponent {
constructor(color: string) {
super("w:highlight");
this.root.push(
new Attributes({
val: color,
}),
);
}
}
export class HighlightComplexScript extends XmlComponent {
constructor(color: string) {
super("w:highlightCs");
this.root.push(
new Attributes({
val: color,
}),
);
}
}