von DPunch » Sa, 11.09.2010 17:11
Aloha
clag hat geschrieben:kann mir jemand sagen was ich da falsch mache ?
Aber sicher.
Code: Alles auswählen
odoc.close(true) '<----------------------------- odoc wird disposed
oDocument = StarDesktop.loadComponentFromURL(dateiurl, , 0, myProp() )
(...)
odoc.storetourl(dateiurl2,myFileProp_pdf() ) '<------------------------------------------- kann also nicht funktionieren
odoc wird mit den Close disposed. Du meinst vermutlich eher
bzw
Code: Alles auswählen
oDoc = StarDesktop.loadComponentFromURL(dateiurl, , 0, myProp() )
clag hat geschrieben:Wenn ich nun im verlauf des Makro nach dem entfernen der Buttons diese Datei noch als PDF exportiere,
werden in der PDF Datei aber alle Buttons die vorher eigentlich schon entfernt wurden trotzdem dargestellt ?
Das liegt daran, dass die Buttons noch auf der Drawpage vorhanden sind.
Du löschst lediglich das Model des Buttons.
Um auch die Zeichnung sofort zu entfernen, musst Du sie entsprechend aus der Drawpage nehmen.
Code: Alles auswählen
Globalscope.BasicLibraries.loadLibrary("Tools")
oDoc = StarDesktop.loadComponentFromURL(dateiurl, , 0, Array() )
oDoc.lockcontrollers
oDrawPage = oDoc.DrawPage
oForm = oDrawPage.Forms.getByIndex(0)
aControlElementsToRemove = Array("Schaltfläche 1","Schaltfläche 2","Schaltfläche 3",_
"Schaltfläche 4","Schaltfläche 5","Schaltfläche 6","Schaltfläche 7","Numerisches Feld 1")
For i = 0 To UBound(aControlElementsToRemove)
sControlName = aControlElementsToRemove(i)
If oForm.hasByName(sControlName) then
oForm.removeByName(sControlName)
End If
Next i
For n = oDrawpage.Count-1 To 0 Step -1
oThisShape = oDrawpage.getByIndex(n)
If NOT isNull(oThisShape.Control) Then
sControlName = oThisShape.Control.Name
If IndexInArray(sControlName,aControlElementsToRemove) > -1 Then
oDrawpage.remove(oThisShape)
End If
End If
Next n
oDoc.unlockControllers
Aloha
[quote="clag"]kann mir jemand sagen was ich da falsch mache ?[/quote]
Aber sicher.
[code]
odoc.close(true) '<----------------------------- odoc wird disposed
oDocument = StarDesktop.loadComponentFromURL(dateiurl, , 0, myProp() )
(...)
odoc.storetourl(dateiurl2,myFileProp_pdf() ) '<------------------------------------------- kann also nicht funktionieren
[/code]
odoc wird mit den Close disposed. Du meinst vermutlich eher
[code]oDocument.storetourl(dateiurl2,myFileProp_pdf() )[/code]
bzw
[code]oDoc = StarDesktop.loadComponentFromURL(dateiurl, , 0, myProp() )[/code]
[quote="clag"]Wenn ich nun im verlauf des Makro nach dem entfernen der Buttons diese Datei noch als PDF exportiere,
werden in der PDF Datei aber alle Buttons die vorher eigentlich schon entfernt wurden trotzdem dargestellt ?[/quote]
Das liegt daran, dass die Buttons noch auf der Drawpage vorhanden sind.
Du löschst lediglich das Model des Buttons.
Um auch die Zeichnung sofort zu entfernen, musst Du sie entsprechend aus der Drawpage nehmen.
[code]
Globalscope.BasicLibraries.loadLibrary("Tools")
oDoc = StarDesktop.loadComponentFromURL(dateiurl, , 0, Array() )
oDoc.lockcontrollers
oDrawPage = oDoc.DrawPage
oForm = oDrawPage.Forms.getByIndex(0)
aControlElementsToRemove = Array("Schaltfläche 1","Schaltfläche 2","Schaltfläche 3",_
"Schaltfläche 4","Schaltfläche 5","Schaltfläche 6","Schaltfläche 7","Numerisches Feld 1")
For i = 0 To UBound(aControlElementsToRemove)
sControlName = aControlElementsToRemove(i)
If oForm.hasByName(sControlName) then
oForm.removeByName(sControlName)
End If
Next i
For n = oDrawpage.Count-1 To 0 Step -1
oThisShape = oDrawpage.getByIndex(n)
If NOT isNull(oThisShape.Control) Then
sControlName = oThisShape.Control.Name
If IndexInArray(sControlName,aControlElementsToRemove) > -1 Then
oDrawpage.remove(oThisShape)
End If
End If
Next n
oDoc.unlockControllers
[/code]