Plugin example

To understand how the plugins work and how they can be written and added to document editors, please see the example of the helloworld.js plugin below:

(function(window, undefined){
    var text = "Hello world!";
    window.Asc.plugin.init = function() {
        Asc.scope.text = text; // export variable to plugin scope
        this.callCommand(function() {
            var oDocument = Api.GetDocument();
            var oParagraph = Api.CreateParagraph();
            oParagraph.AddText(Asc.scope.text); // or oParagraph.AddText(scope.text);
        }, true);
    window.Asc.plugin.button = function(id)
})(window, undefined);

It is the easiest plugin that will insert the 'Hello world!' phrase into your document whenever you press the plugin button.

This plugin and all the other currently existing open source plugin examples are available here: Feel free to fork them, use them with your editors and create your own plugins.


If you have any questions, you can ask our developers at (registration required).