Closing a document

From Apache OpenOffice Wiki
Jump to: navigation, search
thisComponent.close(true)

Please note that the parameter being passed is to do with what should happen if another process has vetoed closing the document or not and not whether the document is to be saved.

So to be sure that a document gets saved before closing use something like:

sub subClose(oDoc)
if fnSave(oDoc) then
        oDoc.close(true)
        fnClose = true
else
        if msgbox("Unable to save the file before closing." & chr(13) & _
         "Close any way?", 4 + 32, "File not saved warning") = 6 then
           oDoc.close(true)
        end if
end if
end sub

fnSave is defined saving a document.

Example of calling subclose:

subClose(thisComponent)
Documentation caution.png Do not use thisComponent.dispose it could crash Apache OpenOffice.
Personal tools