#1744 - Add vanish
and specVanish
This commit is contained in:
@ -45,6 +45,8 @@ export interface IRunStylePropertiesOptions {
|
||||
readonly imprint?: boolean;
|
||||
readonly revision?: IRunPropertiesChangeOptions;
|
||||
readonly border?: IBorderOptions;
|
||||
readonly vanish?: boolean;
|
||||
readonly specVanish?: boolean;
|
||||
}
|
||||
|
||||
export interface IRunPropertiesOptions extends IRunStylePropertiesOptions {
|
||||
@ -215,6 +217,17 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
|
||||
if (options.border) {
|
||||
this.push(new BorderElement("w:bdr", options.border));
|
||||
}
|
||||
|
||||
if (options.vanish) {
|
||||
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_vanish_topic_ID0E6W3O.html
|
||||
// http://www.datypic.com/sc/ooxml/e-w_vanish-1.html
|
||||
this.push(new OnOffElement("w:vanish", options.vanish));
|
||||
}
|
||||
|
||||
if (options.specVanish) {
|
||||
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_specVanish_topic_ID0EIE1O.html
|
||||
this.push(new OnOffElement("w:specVanish", options.vanish));
|
||||
}
|
||||
}
|
||||
|
||||
public push(item: XmlComponent): void {
|
||||
|
@ -519,4 +519,42 @@ describe("Run", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#vanish and #specVanish", () => {
|
||||
it("should correctly set vanish", () => {
|
||||
const run = new Run({
|
||||
vanish: true,
|
||||
});
|
||||
const tree = new Formatter().format(run);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:r": [
|
||||
{
|
||||
"w:rPr": [
|
||||
{
|
||||
"w:vanish": {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("should correctly set specVanish", () => {
|
||||
const run = new Run({
|
||||
specVanish: true,
|
||||
});
|
||||
const tree = new Formatter().format(run);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:r": [
|
||||
{
|
||||
"w:rPr": [
|
||||
{
|
||||
"w:specVanish": {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_tab_topic_ID0EM6AO.html
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
// <xsd:group name="EG_RunInnerContent">
|
||||
|
Reference in New Issue
Block a user