Ask Your Question
0

Close or Terminate Libreoffice - through coding

asked 2015-05-29 12:01:12 +0100

Lion gravatar image

updated 2015-08-27 12:20:04 +0100

Alex Kemp gravatar image

Hello All, My macro running through .ods file, When open .ODS file macro will execute and It will make another csv file which I called it "Output_file.CSV" and Output_file will close also But then I want to close my that file .ODS file, which I has opened it for execute macro

Simple when I click on .ods file , macro should be executed and after close both file output file and yes also .ODS file

Anybody..?

Lion

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-07-26 05:34:10 +0100

doug gravatar image

After you have closed the file, as you know LO will continue to run in the background unless you tell it to terminate, the command for which is starDesktop.terminate. To create a clean shutdown, that does not later prompt for file recovery, a substantial Wait appears necessary prior to the terminate command because of an apparent race condition in LibreOffice. Your Wait may need to be longer, or it might be shorter. Thus the sequence ending with the clean terminate command would be:

ThisComponent.close(True)
Wait 400
starDesktop.terminate

Called by itself, the terminate command does generate a save prompt if the current document is modified, but the shutdown typically will be unclean due to the noted race condition.

(if this answers your question, please accept the answer by clicking the check (image description) to the left)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-05-29 12:01:12 +0100

Seen: 1,459 times

Last updated: Jul 26 '15