[Solved] Close and Reload Buttons

Discuss the spreadsheet application

[Solved] Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 9:11 am

I have a Save button for a document but wonder if it is also possible to have Close and Reload Buttons. I am able to create simple Macros but do not have deeper knowledge. Any help would be appreciated. Thanks.
Last edited by floris v on Sun Dec 22, 2019 4:52 pm, edited 2 times in total.
Reason: Added green checkmark, floris v, moderator
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Villeroy » Sun Dec 22, 2019 11:46 am

Why close and reload? Do you want to start a new document with some presettings? This is an ordinary office suite of the 90ies. Use templates!
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 11:54 am

We use the three which are all separate. Reload is in regular use as there are two people sharing the document via Dropbox. Is this clear? Thanks.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Villeroy » Sun Dec 22, 2019 12:41 pm

Does the menu command File>Reload do what you want? You can assign a keyboard shortcut or toolbar button to that command. In the Tools>Customize you find the "Reload" command in category "Documents".
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Close and Reload Buttons

Postby Zizi64 » Sun Dec 22, 2019 12:45 pm

Reload is in regular use as there are two people sharing the document via Dropbox.


https://help.libreoffice.org/Common/Collaboration

(I never tried the spreadsheet sharing...)
Last edited by Zizi64 on Sun Dec 22, 2019 1:28 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.0; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8773
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 1:21 pm

Can see all the 'bits' but a little lost exactly what I do. Unsure if it affects what you have saiid but I wish the button to be separate, i.e. not part of a toolbar. Thanks.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 2:03 pm

I think that we are possibly close but could VILLEROY reply to my last message, if possible. Thanks.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Villeroy » Sun Dec 22, 2019 2:33 pm

I don't have the list of dispatches at hand right now. For every UI command there is a dispatch URL like .uno:CloseDoc. This URL is behind every GUI element which closes the current document and this type of URL is what the macro recorder records ... oh wait ... no, it is not possible to record the reload command because the context is lost during the operation.

MRI shows that the current frame has a method getConfigurableDispatchInformation( [in] short CommandGroup )
Which command group? http://www.openoffice.org/api/docs/comm ... Group.html shows an ID number for each command group. The group names correspond to the customization dialog's command categories, our "Reload" command was in category "Dokuments" and the named constant DOCUMENT is number 3.
Calling getConfigurableDispatchInformation in MRI with argument 3 writes a list of document related dispatches into MRI's properties tab:
Code: Select all   Expand viewCollapse view
(Name)        (Value Type)      (Value)               (AccessMode)
(0)
Command       string            .uno:FillShadow       
GroupId       short             3                     
(1)
Command       string            .uno:SendMailDo...   
GroupId       short             3                     
(2)
Command       string            .uno:SendMailDocAsMS 
GroupId       short             3                     
(3)
Command       string            .uno:SendMailDo...   
GroupId       short             3                     
(4)
Command       string            .uno:SendMail         
GroupId       short             3                     
(5)
Command       string            .uno:MacroSignature   
GroupId       short             3                     
(6)
Command       string            .uno:ExportToPDF     
GroupId       short             3                     
(7)
Command       string            .uno:ExportDire...   
GroupId       short             3                     
(8)
Command       string            .uno:VersionDialog   
GroupId       short             3                     
(9)
Command       string            .uno:SetDocumen...   
GroupId       short             3                     
(10)
Command       string            .uno:StyleApply       
GroupId       short             3                     
(11)
Command       string            .uno:Print           
GroupId       short             3                     
(12)
Command       string            .uno:Signature       
GroupId       short             3                     
(13)
Command       string            .uno:CloseDoc         
GroupId       short             3                     
(14)
Command       string            .uno:SaveAs           
GroupId       short             3                     
(15)
Command       string            .uno:Save             
GroupId       short             3                     
(16)
Command       string            .uno:EditDoc         
GroupId       short             3                     
(17)
Command       string            .uno:PrinterSetup     
GroupId       short             3                     
(18)
Command       string            .uno:PrintDefault     
GroupId       short             3                     
(19)
Command       string            .uno:Reload           
GroupId       short             3                     
(20)
Command       string            .uno:ExportTo         
GroupId       short             3                     

I could have guessed that ".uno:Reload" is the dispatch URL we were looking for.
#####################################################################
=HYPERLINK(".uno:Reload") in a spredsheet cell reloads the document if you click on that hyperlink.
menu:Insert>Hyperlink lets you create a text hyperlink with that URL or a grey hyperlink button which is the same as form control with action property "Open Document or URL" and the URL is .uno:Reload You could also draw a push button from the "Form Controls" toolbar, get its property dialog, choose action "Open Document or URL" and enter .uno:Reload into the URL box.
#######################################
I would never ever work with shared documents, particularly when they are served on servers of beast. And if I were forced to, I would clearly prefer LibreOffice over OpenOffice.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 3:03 pm

Your first para covers the problems I had when recording a simple Macro, i.e. works for File-S but not File-Reload or File-Close.
Regret your 2nd para leaves me for dead as far as understanding it.
Good news is .uno:Reload seems to work fine.
So now I have Save and Reload buttons. Is there a simple solution for a File Close button?
Thanks again.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Lupp » Sun Dec 22, 2019 3:10 pm

".uno:Reload" is the correct dispatcher command, but
Why not do it this way:
Code: Select all   Expand viewCollapse view
Sub reloadCurrentComponent()
doc = ThisComponent
url = doc.Url
If NOT FileExists(url) Then
  MsgBox("The document was not yet saved to an URL, and can therefore not be reloaded.")
  Exit Sub
End If
doc.Close(true)
doc = StarDesktop.LoadComponentFromUrl(url, "_Blank", 0, Array())
REM You now have a grip on the document again and can pass it to
REM a different Sub e.g.
End Sub
?
Of course, the Sub to use must reside in a module of the local 'Standard' library. Put into the document the process couldn't survive the .Close step.
Last edited by Lupp on Sun Dec 22, 2019 3:15 pm, edited 1 time in total.
On Windows 10: LibreOffice 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2669
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 3:15 pm

Sorry for my lack of knowledge but haven't a clue where to start with that.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Villeroy » Sun Dec 22, 2019 3:31 pm

KeithOO wrote:Sorry for my lack of knowledge but haven't a clue where to start with that.

=HYPERLINK(".uno:Reload")
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 3:37 pm

Unclear. .uno:Reload works for Reload but how do I make a File-Close button?
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am

Re: Close and Reload Buttons

Postby Villeroy » Sun Dec 22, 2019 3:51 pm

=HYPERLINK(".uno:CloseDoc")
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Close and Reload Buttons

Postby KeithOO » Sun Dec 22, 2019 3:59 pm

With your help, I now have my Reload and Close buttons which seem to work fine.
Thank you very much.
Open Office 4.1.7 MacOS 10.13.6
KeithOO
 
Posts: 114
Joined: Sat Jun 15, 2013 8:34 am


Return to Calc

Who is online

Users browsing this forum: MSN [Bot] and 6 guests