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: users+help@global.libreoffice.org
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
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.