0

I'm looking for a way to call LibreOffice Calc from js script (for example open existing file on disk). I know that I can open Excel using ActiveXObject, but with Calc it not working.

<script type="text/javascript">
  function test() {
    var Excel = new ActiveXObject("Excel.Application");
    Excel.Visible = true;
    Excel.Workbooks.Open("teste.xlsx");
  }
</script>

update: first priority is IE

1 Answer 1

1

You can't. (At least not in a standard browser)

For obvious security reasons, it is not possible to start native applications from JavaScript. Imagine if any website you visit could just randomly start programs on your computer.

ActiveXObject is an old feature of the Internet Explorer and will definitely not work in any modern browser (as the subtle warning on its MDN page indicates: https://developer.mozilla.org/en-US/docs/Archive/Web/JavaScript/Microsoft_Extensions/ActiveXObject).

Edit: here is an excellent article about the browser sandbox and why it is necessary: https://web.dev/browser-sandbox/

Sign up to request clarification or add additional context in comments.

2 Comments

Thk, I know about ActiveXObject, but for example i can run Calc from IE?
According to this LibreOffice help article, it is possible to control LibreOffice via an ActiveXObject: help.libreoffice.org/7.0/en-US/text/shared/guide/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.