[Solved] Making Web View the default
[Solved] Making Web View the default
Variations of this topic have been discussed, but after researching the forums, I couldn't find a satisfactory answer.
When I open an existing document in Writer, it appears in Print view. I want my existing documents to open in Web view.
I understand how to use templates, and I'm able to create new documents with a template that will put up a blank document in Web view. However any existing documents that I open will do so in Print view, even if I saved them while they were in Web view.
There have been comments to the effect that state the last view mode is some kind of attribute that is saved along with the file. This is not the case for my installation. I can create a new document with a template that specifies Web view, and save it, but when I reopen it, it will display in Page view. In fact, if I open an existing document and make no changes to it, other than changing it to Web view, the File / Save menu item will be greyed out, indicating to me that there was nothing changed in the data nor metadata for the document, hence there is no such "View" attribute associated with the saved file.
I've seen workarounds that involve running a macro for the Open File event, which activates Web view, but I don't want to install a Java Runtime on my system just for that purpose.
I've seen solutions for starting Libre Writer in web view with a -web parameter, but I don't know how that could be done if I'm double-clicking the file itself to start the app.
To me, print view is similar to Word's Print Preview - something I'd look at just before sending a doc to the printer. And for documents with large margins run on a netbook with a small display, it wastes valuable working space when composing a document.
Any help would be appreciated.
When I open an existing document in Writer, it appears in Print view. I want my existing documents to open in Web view.
I understand how to use templates, and I'm able to create new documents with a template that will put up a blank document in Web view. However any existing documents that I open will do so in Print view, even if I saved them while they were in Web view.
There have been comments to the effect that state the last view mode is some kind of attribute that is saved along with the file. This is not the case for my installation. I can create a new document with a template that specifies Web view, and save it, but when I reopen it, it will display in Page view. In fact, if I open an existing document and make no changes to it, other than changing it to Web view, the File / Save menu item will be greyed out, indicating to me that there was nothing changed in the data nor metadata for the document, hence there is no such "View" attribute associated with the saved file.
I've seen workarounds that involve running a macro for the Open File event, which activates Web view, but I don't want to install a Java Runtime on my system just for that purpose.
I've seen solutions for starting Libre Writer in web view with a -web parameter, but I don't know how that could be done if I'm double-clicking the file itself to start the app.
To me, print view is similar to Word's Print Preview - something I'd look at just before sending a doc to the printer. And for documents with large margins run on a netbook with a small display, it wastes valuable working space when composing a document.
Any help would be appreciated.
Last edited by JOakly on Tue Mar 04, 2014 1:59 am, edited 2 times in total.
LibreOffice 4.1.5.3, Windows XP
Re: Making Web View the default
I opened a document, made a trivial edit, changed to web view and saved it. When I opened it again, it was in web view. It may be important to have a user name in the menu Tools -> Options -> LibreOffice -> User Data.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Making Web View the default
Sorry, there's no way to do this, short of using some macro code. It shouldn't require Java to be installed--OO can use macro code written in BASIC or Python with no extra software to install.JOakly wrote:... I want my existing documents to open in Web view. ...
AOO4/LO5 • Linux • Fedora 23
Re: Making Web View the default
How do I get my BASIC macro to run automagically when I open a document without enabling Java?acknak wrote:Sorry, there's no way to do this, short of using some macro code. It shouldn't require Java to be installed--OO can use macro code written in BASIC or Python with no extra software to install.JOakly wrote:... I want my existing documents to open in Web view. ...
I wrote a BASIC macro (actually recorded my action of turning on Web view). Then I tried to assign it to the Open File activity using:
Tools / Customize / (Events tab) / Open Document
but when I click Macro, I get:
LibreOffice requires a Java Runtime to perform this task...
LibreOffice 4.1.5.3, Windows XP
Re: Making Web View the default
Best to ask about programming under the macro area of the forum: viewforum.php?f=20
I know next to nothing about OO programming but I'm quite sure there are alternatives to Java.
I just came across a post saying that parts of the macro organizer do require Java. It specifically mentioned the "Run Macro" function.
I don't know if I understood the message correctly or if it's still accurate, but maybe there is an indirect requirement for Java--that is, you can create macros in other languages but you have to have Java to use the Tools > Macros > ... features.
I've no experience with any of this, so I'll just butt out at this point
I know next to nothing about OO programming but I'm quite sure there are alternatives to Java.
Edit: PS: |
I don't know if I understood the message correctly or if it's still accurate, but maybe there is an indirect requirement for Java--that is, you can create macros in other languages but you have to have Java to use the Tools > Macros > ... features.
I've no experience with any of this, so I'll just butt out at this point

AOO4/LO5 • Linux • Fedora 23
Re: Making Web View the default
You can assign macros to events so the macro runs when the event occurs. See Help on Macros and Assign. A little experimenting shows you need the macro to run when the View created event happens.
1 Record a macro to set the current document to web view and save it. This is the code I saved
2 Assign the macro to the View created event (This is where the experimenting came in - which event to choose)
Tools > Macros > Organise > Basic > Assign
Scroll Save in to Open Office (So it applies to all documents, not just the currently open document)
Highlight View created
Click Macro and assign web_view to View created.
Now when you open any document, or create any new document, it opens in web view. In the image below, my macro was called z_web.
1 Record a macro to set the current document to web view and save it. This is the code I saved
Code: Select all
sub web_view
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BrowseView"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:BrowseView", "", 0, args1())
end sub
Tools > Macros > Organise > Basic > Assign
Scroll Save in to Open Office (So it applies to all documents, not just the currently open document)
Highlight View created
Click Macro and assign web_view to View created.
Now when you open any document, or create any new document, it opens in web view. In the image below, my macro was called z_web.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Making Web View the default
Thank you for your very detailed and documented reply. However, I'm looking for a solution that doesn't involve installing the Java Runtime environment.John_Ha wrote:You can assign macros to events so the macro runs when the event occurs....
Even though an event-triggered macro may be written in BASIC, apparently to set up the event-macro association, Java needs to be installed. At the point when I select the Macro which is to be tied to the event, I get a message indicating that Java Runtime needs to be enabled to perform such an action. (See previous post).
LibreOffice 4.1.5.3, Windows XP
Re: Making Web View the default
Thank you for your suggestion. I tried populating all of the UserData fields as you suggested, but unfortunately got the same results for all of the tests I ran in the original post.FJCC wrote:I opened a document, made a trivial edit, changed to web view and saved it. When I opened it again, it was in web view. It may be important to have a user name in the menu Tools -> Options -> LibreOffice -> User Data.

LibreOffice 4.1.5.3, Windows XP
Re: Making Web View the default
Tools>Options>Java...
Disable the use of Java.
Basic macros do not need any Java except for dialog Tools>Macros>Run... which is obsolete anyway because you can test your macros via Tools>Macros>Organize>[Language]>Run...
Disable the use of Java.
Basic macros do not need any Java except for dialog Tools>Macros>Run... which is obsolete anyway because you can test your macros via Tools>Macros>Organize>[Language]>Run...
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Making Web View the default
As Villeroy says, you apparently don't need Java for macros to run.JOakly wrote: However, I'm looking for a solution that doesn't involve installing the Java Runtime environment.
To confirm this, I deleted my Java (Control Panel > Add / remove programs, logoff-logon) and I was still able to run the macro (I just ignored the error message and continued) and to assign the macro to the View created event (again I just ignored the error message and continued). After assigning it, all documents opened in web view.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Making Web View the default
That irritating error message has 3 answer buttons:
[Yes], use some installed Java
[No], continue without Java
[Cancel] the current action.
We choose [No].
[Yes], use some installed Java
[No], continue without Java
[Cancel] the current action.
We choose [No].
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Making Web View the default
SOLVED!
Thank all of you for your suggestions. I did some tests and found out, for this View changing macro action at least, it was necessary to globally save the Event-Macro association in LibreOffice, NOT in the document itself. The option for where this event trigger is saved, as John_Ha points out in his well-documented comment, is in the Customize Events dialog.
Saving the Event-Macro association with the document did not produce the desired results for the specific document nor any other document. It only worked correctly when it was globally saved in LibreOffice.
Furthermore, I discovered that I was able to get my View changing macro to give me the correct results if I associated it with either the "View Created" event, as well as the "Open Document" event. Either event would trigger the macro and the change to Web View, as long as I saved the Event-Macro action globally in LibreOffice.
I experimented with the pop up window "...do you want to enable Java runtime". Whether I answered "No" or "Cancel" didn't change the results.
And it also didn't matter how I navigated to the Customize Events dialog; whether it was:
Tools / Customize / Events
or
Tools / Macros / Organize / Basic / Assign
The resulting assignment of the macro to the Event produced the correct results as long as it was globally saved to LibreOffice.
And no Java Runtime was harmed (enabled
) in the production of these results!
Thank all of you for your suggestions. I did some tests and found out, for this View changing macro action at least, it was necessary to globally save the Event-Macro association in LibreOffice, NOT in the document itself. The option for where this event trigger is saved, as John_Ha points out in his well-documented comment, is in the Customize Events dialog.
Saving the Event-Macro association with the document did not produce the desired results for the specific document nor any other document. It only worked correctly when it was globally saved in LibreOffice.
Furthermore, I discovered that I was able to get my View changing macro to give me the correct results if I associated it with either the "View Created" event, as well as the "Open Document" event. Either event would trigger the macro and the change to Web View, as long as I saved the Event-Macro action globally in LibreOffice.
I experimented with the pop up window "...do you want to enable Java runtime". Whether I answered "No" or "Cancel" didn't change the results.
And it also didn't matter how I navigated to the Customize Events dialog; whether it was:
Tools / Customize / Events
or
Tools / Macros / Organize / Basic / Assign
The resulting assignment of the macro to the Event produced the correct results as long as it was globally saved to LibreOffice.
And no Java Runtime was harmed (enabled

LibreOffice 4.1.5.3, Windows XP