added #strike and #doubleStrike methods to paragraphStyle
This commit is contained in:
@ -101,6 +101,16 @@ export class ParagraphStyle extends Style {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public strike(): ParagraphStyle {
|
||||||
|
this.addRunProperty(new formatting.Strike());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public doubleStrike(): ParagraphStyle {
|
||||||
|
this.addRunProperty(new formatting.DoubleStrike());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public underline(underlineType?: string, color?: string): ParagraphStyle {
|
public underline(underlineType?: string, color?: string): ParagraphStyle {
|
||||||
this.addRunProperty(new formatting.Underline(underlineType, color));
|
this.addRunProperty(new formatting.Underline(underlineType, color));
|
||||||
return this;
|
return this;
|
||||||
|
@ -260,6 +260,36 @@ describe("ParagraphStyle", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("#strike", () => {
|
||||||
|
const style = new ParagraphStyle("myStyleId")
|
||||||
|
.strike();
|
||||||
|
const tree = new Formatter().format(style);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:style": [
|
||||||
|
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
|
||||||
|
{"w:pPr": []},
|
||||||
|
{"w:rPr": [
|
||||||
|
{"w:strike": [{_attr: {"w:val": true}}]},
|
||||||
|
]},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("#doubleStrike", () => {
|
||||||
|
const style = new ParagraphStyle("myStyleId")
|
||||||
|
.doubleStrike();
|
||||||
|
const tree = new Formatter().format(style);
|
||||||
|
expect(tree).to.deep.equal({
|
||||||
|
"w:style": [
|
||||||
|
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
|
||||||
|
{"w:pPr": []},
|
||||||
|
{"w:rPr": [
|
||||||
|
{"w:dstrike": [{_attr: {"w:val": true}}]},
|
||||||
|
]},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("#bold", () => {
|
it("#bold", () => {
|
||||||
const style = new ParagraphStyle("myStyleId")
|
const style = new ParagraphStyle("myStyleId")
|
||||||
.bold();
|
.bold();
|
||||||
|
Reference in New Issue
Block a user