// create an apply a custom character style

import { CreateDocx, OptionsRpr, OptionsText } from "../../../build";
import * as fs from "fs";

const docx = new CreateDocx();

// create custom character style
const characterStyle: OptionsRpr = {
    bold: true,
    color: "FF0000",
    fontSize: 18,
    italic: true,
};
docx.createCharacterStyle("myStyle", characterStyle);

// add a text content with the new custom character style
const textA: OptionsText = {
    fontSize: 14,
    text: "New content ",
};
const textB: OptionsText = {
    rStyle: "myStyle",
    text: "and other content.",
    underline: "single",
};
docx.addText([textA, textB]);

docx.save().then(contents => {
    fs.writeFileSync("createCharacterStyle_1.docx", Buffer.from(contents));
});
