Ask Your Question

Opening the same file in two windows w/ Command Line Switch

asked 2018-04-05 16:37:37 +0200

Nickprovs gravatar image

Is there a way to do this currently? It seems like in every case, trying to open the same document twice brings focus to the currently open version of that document. I know the --view command line switch creates a read only copy of a document and opens that... but it seems it can only be opened once.

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-04-05 21:05:21 +0200

Jim K gravatar image

updated 2018-04-06 01:22:45 +0200

Two alternatives:

  • Use a script to create a temporary copy of the file, and then open both the original and the copy.
  • Install both LibreOffice and Apache OpenOffice, and then open in each.


Now I see your other question at and understand what you are trying to do. It would have been helpful to include that link in your question.

Write a macro that calls Window -> New Window and then call it from the command line.


To do this, put the following code under My Macros.

Sub NewWindow
    frame = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("")
    dispatcher.executeDispatch(frame, ".uno:NewWindow", "", 0, Array())
End Sub

Then for example, enter this command to open the document called "Untitled 1.odt".

soffice macro:///Standard.Module1.NewWindow "Untitled 1.odt"

The result on my system is two side-by-side windows.

two windows side by side

edit flag offensive delete link more


Awesome Macro. That should be good to know. I didn't link the question because the question wasn't mine and although I commented on it to highlight the answer supplied didn't solve that user's problem, what I'm actually trying to achieve is a bit different. I work with huge displays. So it would be nice to open a document many times and place it on different locations on the wall. I use a program to invoke other programs to display on the wall. So a command line switch is really what I'm after.

Nickprovs gravatar imageNickprovs ( 2018-04-06 14:59:33 +0200 )edit

That said... this is an awesome answer for those looking to view two parts of the same document. Thanks for such a detailed response.

Also I've written a "LibreOfficeWrapper" exe which takes in cmd line switch args and the document as the last arg and it creates a read only copy in a folder in windows temp and opens it. When soffice.bin closes, it deletes the copy. I'm going to keep working on it but I requested a cmd line switch on bugs. Until a perm sol, if anyone wants this, let me know.

Nickprovs gravatar imageNickprovs ( 2018-04-06 15:00:09 +0200 )edit

I'm afraid I have no idea why anyone would want that feature, but it might be a good idea to add your own answer in case someone else wants the same thing. You could even attach the .exe file after renaming it. However, downloading an .exe file from a site like this is risky. Someone could post a virus instead.

Jim K gravatar imageJim K ( 2018-04-06 19:40:07 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-04-05 16:37:37 +0200

Seen: 119 times

Last updated: Apr 06 '18