On Wed, Dec 19, 2012 at 8:04 AM, Robert Barbey <robert.bar...@acrolinx.com>wrote:
> Hi everyone, > > is it possible to get the kind of document currently opened in Writer via > the API? Ideally, this would be a MIME type kind of thing. > > Thank you very much! > > Best, > Robert Do you mean to say what kind of document is it open in OpenOffice? like if its writer or calc or impress? Or do you mean the metadata of the document. Here is a basic code for each: This is to verify is a text document: Dim s As String s = "com.sun.star.text.TextDocument" If ThisComponent.supportsService(s) Then Print "The document is a text document" Else Print "The document is not a text document" End If A more complete can be seen here: http://ooo.pastebin.ca/2300890 Here is for the user fields ' Access the user fields for the information regarding the document. vInfo = vDoc.getDocumentInfo() vVal = oData.ElementNames s = "===User Fields===" For i = 0 to vInfo.GetUserFieldCount() - 1 sKey = vInfo.GetUserFieldName(i) sVal = vInfo.GetUserFieldValue(i) s = s & Chr$(13) & "(" & sKey & "," & sVal & ")" Next i '(Info 1,) '(Info 2,) '(Info 3,) '(Info 4,) MsgBox s, 0, "User Fields" -- Alexandro Colorado Apache OpenOffice Contributor http://es.openoffice.org