Close all opened Writer documents
Posted: Thu Mar 22, 2012 11:38 am
I am trying to close all opened writer documents. I thought I had a solution but when i also had a calc spreadsheet open the code would close the opened spreadsheet also. How do i distinguish between components so i only close writer components. Code so far:
Code: Select all
var
lComponents, lDocument: OleVariant;
begin
lComponents := FDesktop.GetComponents.CreateEnumeration;
while lComponents.hasMoreElements do
begin
lDocument := lComponents.NextElement;
lDocument.Close(True);
end;
end;
...
//FDesktop is created like so
FDesktop := FLibreOffice.createInstance('com.sun.star.frame.Desktop');