Debugging

You can debug any Document Builder component. To do this, follow the instructions below.

Executing from a browser (for plugins and macros)

  1. Open the Plugins tab and click Macros.

  2. Use the debugger command in your script:

    debugger;
    const oDocument = Api.GetDocument();
    const oParagraph = oDocument.GetElement(0);
    oParagraph.AddText("Hello world!");
    
  3. Open the developer console by pressing the F12 button.

  4. Click Play icon to run your script.

Please note that the debugger command will only work if the development tools are open. Otherwise, the browser will ignore it.

Builder debugger

The debugger command works as a breakpoint and pauses the execution at the script point where this command is inserted.

Executing from Builder.Framework or Builder.App

This instruction can also be used for any Builder.Framework version: C++, COM, .Net.

  1. Open a terminal in the DocumentBuilder folder.

  2. Set the V8_USE_INSPECTOR environment variable to 1:

    Windows

    SET V8_USE_INSPECTOR=1
    

    Linux

    export  V8_USE_INSPECTOR=1
    
  3. Run the Builder script with the docbuilder command:

    docbuilder script.docbuilder
    
  4. A link will appear in the terminal. You must open it in your Chrome/Chromium browser to connect to the JavaScript context.

    Terminal

  5. Set the breakpoints by clicking the line numbers and run your script again.

  6. Now you can debug the executed methods.

    DevTools

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).