dream-macro
v1.0.0
Published
Javascript package for [DreamMacro](https://github.com/gestonline/dreamMacro).
Downloads
8
Readme
Dream macro JS
Javascript package for DreamMacro.
Instalation
Include it via CDN:
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dream-js-min.js"></script>
<script type="module">
// your code here
</script>
Quick start
To initialize LibreOffice Online, add a button, and call a python macro when the button is pressed, simply do that:
<script type="module">
import { LOOL } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/dream-js-min.js';
const lool = new LOOL("loolIframe");
const setColor = () => {
lool.callMacro('SetCellColor', 'SetCellColor', {
x: {
type: 'long',
value: 0
},
y: {
type: 'long',
value: 0
},
color: {
type: 'long',
value: parseInt('0xff0000')
}
});
};
const button = {
id: 'test_set_color',
imgurl: 'http://localhost:8000/blood.png',
hint: 'Set color of the first cell',
label: 'Set color'
}
lool.addButton(button, setColor);
lool.addMacroCallback('SetCellColor', 'SetCellColor', (data) => {
console.log('Result set cell color macro: ' + data.result.value);
})
</script>
Documentation
Read the documentation to read full API references: Documentation