Archi Forum

Archi Plug-ins => jArchi => Topic started by: rheward on September 26, 2019, 17:02:32 PM

Title: Is there a Word version of 'myexcel.js'
Post by: rheward on September 26, 2019, 17:02:32 PM
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)?
Title: Re: Is there a Word version of 'myexcel.js'
Post by: Jean-Baptiste Sarrodie on September 26, 2019, 19:09:51 PM
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 (https://codepen.io/anon/pen/dqoVgQ?editors=1010), it seems that you can simply load the lib and tune a bit the saving process to use jArchi's one.

Regards,

JB
Title: Re: Is there a Word version of 'myexcel.js'
Post by: rheward on September 27, 2019, 09:17:52 AM
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.