von Stephan » So, 03.01.2010 10:17
peterschleif hat geschrieben:Hallo.
Peter
das liefert den Titel des Fensters (
http://api.openoffice.org/docs/common/r ... Title.html
), aber nicht dessen Namem (
http://api.openoffice.org/docs/common/r ... ml#getName), der sollte so zu ermitteln sein wie es Scalaia990 schreibt.
Leider bekomme ich dabei in z.B. OOo 2.4.0 auch nur eine leere Rückgabe, in z.B. OOo 1.1.4 hingegen funktioniert es so wie es soll, z.B. folgender code von Pitoniak läuft dort problemlos:
Code: Alles auswählen
Sub UseAnExistingFrame
Dim noArgs() 'An empty array for the arguments
Dim vDoc 'The loaded component
Dim sURL As String 'URL of the document to load
Dim nSearch As Long 'Search flags
Dim sFName As String 'Frame Name
Dim vFrame 'Document Frame
Dim s As String 'Display string
REM Search globally for this
nSearch = com.sun.star.frame.FrameSearchFlag.GLOBAL + _
com.sun.star.frame.FrameSearchFlag.CREATE
REM I can even open a real file for this, but I don't know what files
REM you have on your computer so I create a new Writer document instead
REM sURL = "file:///home/andy/doc1.sxw"
sURL = "private:factory/swriter"
REM Create a frame with the name MyFrame rather than _default
sFName = "MyFrame"
vFrame = ThisComponent.CurrentController.Frame
vDoc = vFrame.LoadComponentFromUrl(sURL, sFName, nSearch, noArgs())
If IsNull(vDoc) Then
Print "Failed to create a document"
Exit Sub
End If
REM The name of the frame is MyFrame. Note that the name has nothing
REM to do with the title!
sFName = vDoc.CurrentController.Frame.Name
s = "Created document to frame " & sFName & CHR$(10)
MsgBox s
End Sub
Gruß
Stephan
[quote="peterschleif"]Hallo.
[code]MsgBox ThisComponent.CurrentController.Frame.Title[/code]
Peter[/quote]
das liefert den Titel des Fensters (http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XTitle.html
), aber nicht dessen Namem (http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XFrame.html#getName), der sollte so zu ermitteln sein wie es Scalaia990 schreibt.
Leider bekomme ich dabei in z.B. OOo 2.4.0 auch nur eine leere Rückgabe, in z.B. OOo 1.1.4 hingegen funktioniert es so wie es soll, z.B. folgender code von Pitoniak läuft dort problemlos:
[code]Sub UseAnExistingFrame
Dim noArgs() 'An empty array for the arguments
Dim vDoc 'The loaded component
Dim sURL As String 'URL of the document to load
Dim nSearch As Long 'Search flags
Dim sFName As String 'Frame Name
Dim vFrame 'Document Frame
Dim s As String 'Display string
REM Search globally for this
nSearch = com.sun.star.frame.FrameSearchFlag.GLOBAL + _
com.sun.star.frame.FrameSearchFlag.CREATE
REM I can even open a real file for this, but I don't know what files
REM you have on your computer so I create a new Writer document instead
REM sURL = "file:///home/andy/doc1.sxw"
sURL = "private:factory/swriter"
REM Create a frame with the name MyFrame rather than _default
sFName = "MyFrame"
vFrame = ThisComponent.CurrentController.Frame
vDoc = vFrame.LoadComponentFromUrl(sURL, sFName, nSearch, noArgs())
If IsNull(vDoc) Then
Print "Failed to create a document"
Exit Sub
End If
REM The name of the frame is MyFrame. Note that the name has nothing
REM to do with the title!
sFName = vDoc.CurrentController.Frame.Name
s = "Created document to frame " & sFName & CHR$(10)
MsgBox s
End Sub[/code]
Gruß
Stephan