von gschuckar » Di, 11.09.2007 18:48
Hallo,
ich möchte gerne ein vorhandenes Calc Dokument laden, aber nur, wenn es nicht bereits geladen ist. Zur zeit mache ich das so:
----------------
option explicit
dim oDoc as object
Sub Main
oDoc = getDocument()
End Sub
function getDocument() as Object
on Error goto ErrorHandler
Dim strLoadURL as String
Dim loadProps(0) as new com.sun.star.beans.PropertyValue
Dim oSheets as Object
' load document hidden
loadProps(0).Name = "Hidden"
'loadProps(0).Value = true ' load document hidden
loadProps(0).Value = false ' load unhide
strLoadURL = getWorkPath() & "/CalcTestDoc.ods"
getDocument = StarDesktop.loadComponentFromURL(strLoadURL,"_default",0,loadProps())
exit function
ErrorHandler:
MsgBox "Error " & Err & ": " & Error$ & " (line : " & Erl & ")" & "in main.getDocument"
end function
private function getWorkPath() as String
Dim oPathSettings as Object
oPathSettings = createUnoService("com.sun.star.util.PathSettings")
getWorkPath = oPathSettings.Work
end function
---------
Wie kann ich feststellen, ob das Dokument CalcTestDoc.ods bereits geladen ist?
Danke für einen Hilfreichen Tip
Gerd Schuckar
Hallo,
ich möchte gerne ein vorhandenes Calc Dokument laden, aber nur, wenn es nicht bereits geladen ist. Zur zeit mache ich das so:
----------------
option explicit
dim oDoc as object
Sub Main
oDoc = getDocument()
End Sub
function getDocument() as Object
on Error goto ErrorHandler
Dim strLoadURL as String
Dim loadProps(0) as new com.sun.star.beans.PropertyValue
Dim oSheets as Object
' load document hidden
loadProps(0).Name = "Hidden"
'loadProps(0).Value = true ' load document hidden
loadProps(0).Value = false ' load unhide
strLoadURL = getWorkPath() & "/CalcTestDoc.ods"
getDocument = StarDesktop.loadComponentFromURL(strLoadURL,"_default",0,loadProps())
exit function
ErrorHandler:
MsgBox "Error " & Err & ": " & Error$ & " (line : " & Erl & ")" & "in main.getDocument"
end function
private function getWorkPath() as String
Dim oPathSettings as Object
oPathSettings = createUnoService("com.sun.star.util.PathSettings")
getWorkPath = oPathSettings.Work
end function
---------
Wie kann ich feststellen, ob das Dokument CalcTestDoc.ods bereits geladen ist?
Danke für einen Hilfreichen Tip
Gerd Schuckar