hallo alle mit einander
ich benutze oo 3.2 auf win xp ich "programmiere" mit basic
für mich ist das ganze thema noch neuland also hoffe ich das mir da jemand weiter helfen kann
ich nehme auch sehr gerne links an
zum problem
ich ziehe daten aus einem calc document und füge sie dann in ein writer document ein.
nun will ich aber zurück in das offene calc document wechseln.
kann mir jemand vlt einen tip geben was es für eine alternative zu ThisComponent gibt.
oder wie ich in das vorgänger modell wechsel loadComponent öffnet ja ein geschlossenes document
gibt es da vlt. eine alternative halt statt das document zu laden da es ja schon offen ist.
vielen dank im vorraus lex
in ein nicht actives document wechseln
Moderator: Moderatoren
- komma4
- ********
- Beiträge: 5332
- Registriert: Mi, 03.05.2006 23:29
- Wohnort: Chon Buri Thailand Asia
- Kontaktdaten:
Re: in ein nicht actives document wechseln
Wenn Du die Dokumente mit Basic öffnen würdest... hättest Du gleich auch die Objektreferenz.
Wenn nicht, dann hilft es Dir die geöffneten Komponenten durchzugehen, mit dem Code von DannyB -dem sogenannten ComponentWalker- solltest Du weiter kommen...
Viel Erfolg!
Wenn nicht, dann hilft es Dir die geöffneten Komponenten durchzugehen, mit dem Code von DannyB -dem sogenannten ComponentWalker- solltest Du weiter kommen...
Code: Alles auswählen
REM http://www.oooforum.org/forum/viewtopic.phtml?t=3712
REM DannyB 2003-11-06
Sub Main
oComponents = StarDesktop.getComponents()
' Show me how many total components are open?
nCount = 0
oComponentWalker = oComponents.createEnumeration()
Do While oComponentWalker.hasMoreElements()
oComponent = oComponentWalker.nextElement()
nCount = nCount + 1
Loop
Print "There are "; nCount; " components open."
' Walk through the components looking for documents of a specific type.
oComponentWalker = oComponents.createEnumeration()
Do While oComponentWalker.hasMoreElements()
oComponent = oComponentWalker.nextElement()
' See if component is a document.
' Any com.sun.star.document.OfficeDocument supports XModel.
' Of course, we could have just checked for the service OfficeDocument,
' see the Drawing example below for how to check for a service.
If HasUnoInterfaces( oComponent, "com.sun.star.frame.XModel" ) Then
' It will have this particular interface if it is a spreadsheet document.
If HasUnoInterfaces( oComponent, "com.sun.star.sheet.XSpreadsheetDocument" ) Then
' Notify me if we found a spreadsheet document has a sheet named "Sheet2",
' and cell C2 of that sheet contains the text "Meow Mix".
oSheets = oComponent.getSheets()
If oSheets.hasByName( "Sheet2" ) Then
oSheet = oSheets.getByName( "Sheet2" )
If oSheet.getCellByPosition( 2, 1 ).getFormula() = "Meow Mix" Then
MsgBox( "Found the componenet, which is a spreadsheet, which has a sheet names Sheet2, whose cell C2 contains Meow Mix." )
EndIf
EndIf ' If it has Sheet2
EndIf ' If it is a spreadsheet
' If the component is Untitled, that is, has not been saved, then notify me.
If Not oComponent.hasLocation() Then
MsgBox( "Untitled component found." )
EndIf ' if it is untitled.
' If the document is saved, and is C:\MYDOC.SXC
If oComponent.hasLocation() Then
cURL = oComponent.getLocation()
cFile = ConvertFromURL( cURL )
msgbox cFile
REM If UCase( cFile ) = "C:\MYDOC.SXC" Then
If cFile = "/home/zwinni/findeDok.odt" Then
MsgBox( "Found the document C:\MYDOC.SXC" )
EndIf
EndIf
' It will have this particular SERVICE if it is a drawing document.
If oComponent.SupportsService( "com.sun.star.drawing.DrawingDocument" ) Then
' Notify me if we found a drawing document that has a shape named "Apple Jacks"
' on its second page.
oDrawPages = oComponent.getDrawPages()
if oDrawPages.getCount() >= 2 Then
oDrawPage = oDrawPages.getByIndex( 1 )
For nShape = 0 To oDrawPage.getCount() - 1
oShape = oDrawPage.getByIndex( i )
If oShape.getName() = "Apple Jacks" Then
MsgBox( "Found the component, which is a drawing, which has a shape named Apple Jacks on its second page." )
EndIf
Next
EndIf ' If it has 2 or more pages
EndIf ' If it is a drawing
EndIf ' if it has XModel (which probably means it is an OfficeDocument)
Loop
End Sub
Viel Erfolg!
Cheers
Winfried
aktuell: LO 5.3.5.2 30m0(Build:2) SUSE rpm, unter Linux openSuSE Leap 42.3 x86_64/KDE5
DateTime2 Einfügen von Datum/Zeit/Zeitstempel (als OOo Extension)
Winfried
aktuell: LO 5.3.5.2 30m0(Build:2) SUSE rpm, unter Linux openSuSE Leap 42.3 x86_64/KDE5
DateTime2 Einfügen von Datum/Zeit/Zeitstempel (als OOo Extension)
Re: in ein nicht actives document wechseln
ja danke ich hoffe das es mir weiter hilt sieht soweit ganz gut aus.
mfg lex
mfg lex