Is there a Word version of 'myexcel.js'

Started by rheward, September 26, 2019, 17:02:32 PM

Previous topic - Next topic

rheward

I've managed to use the myexcel.js library file from jArchi, but is there an equivalent for creating a MS Word document (open office xml)?

Jean-Baptiste Sarrodie

Hi,

In fact you can use almost any javascript library designed for Node.js or browser.

A quick search returns several hits for https://docx.js.org. Ifyou look at this example, it seems that you can simply load the lib and tune a bit the saving process to use jArchi's one.

Regards,

JB
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rheward

Thanks for the guidance. Super exciting - I grabbed the download and looked at the .js but when I try to load use it from jArchi, it doesn't like a few things. Firstly there were a lot of <CR>'s in there. Simple fix to find and replace. Now it doesn't like class definitions that it uses. For example:


class Bold extends xml_components_1.XmlComponent {
    constructor() {
        super("w:b");
        this.root.push(new xml_components_1.Attributes({
            val: true,
        }));
    }
}
exports.Bold = Bold;


I'm not much of a js expert, but I believe classes were introduced later in the standard. Anyone know of a way round this? I think it might be possible to recode the classes as functions?

Or maybe I look for an alternative library.