Hallo,
in Basic , we use a function to find the doctype
Function GetDocumentType(oDocument)
On Local Error GoTo NODOCUMENTTYPE
' ShowSupportedServiceNames(oDocument)
If
oDocument.SupportsService("com.sun.star.sheet.SpreadsheetDocument") Then
GetDocumentType() = "scalc"
ElseIf oDocument.SupportsService("com.sun.star.text.TextDocument") Then
GetDocumentType() = "swriter"
ElseIf
oDocument.SupportsService("com.sun.star.drawing.DrawingDocument") Then
GetDocumentType() = "sdraw"
ElseIf
oDocument.SupportsService("com.sun.star.presentation.PresentationDocument")
Then
GetDocumentType() = "simpress"
ElseIf
oDocument.SupportsService("com.sun.star.formula.FormulaProperties") Then
GetDocumentType() = "smath"
End If
NODOCUMENTTYPE:
If Err <> 0 Then
GetDocumentType = ""
Resume GOON
GOON:
End If
End Function
Hope it helps
I am trying to close all the opened writer documents and thought i had a
working solution until i tested the code while a calc spreadsheet was
opened. The spreadsheet was also closed. How do i determine the type of the
opened document so i can close it only if it's opened in writer? The code i
have right now is as follows:
<pre>
var
lComponents, lDocument: OleVariant;
begin
lComponents := FDesktop.GetComponents.CreateEnumeration;
while lComponents.hasMoreElements do
begin
lDocument := lComponents.NextElement;
lDocument.Close(True);
end;
end;
</pre>
--
View this message in context:
http://nabble.documentfoundation.org/Delphi-How-to-close-all-opened-writer-documents-tp3848246p3848246.html
Sent from the Users mailing list archive at Nabble.com.
--
For unsubscribe instructions e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted