Closing a document
From Apache OpenOffice Wiki
Revision as of 17:44, 16 May 2006 by ErAck (talk | contribs) (Category:Basic:Tutorials Category:Tutorials)
[oobas]
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:
[oobas]
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:
[oobas]
subClose(thisComponent)
| Warning: | Do not use thisComponent.dispose it could crash OpenOffice.org. |