I work on visual studio in vb.net language.
I want to create and save automaticaly a calc file. I use the tool " VB.NET OOo" that you could find on this website http://berma.pagesperso-orange.fr/
The beginning of my code is working until the save process. I try to find the solution during hours but nothing works
This is my code
Code: Select all
Sub Test
ConnectOpenOffice()
Dim myDoc As Object
myDoc = StarDesktop.loadComponentFromURL("private:factory/scalc", "_hidden", 0, dummyArray)
Url = ConvertToURL("C:\test.ods")
Dim arg(0) As Object
arg(0) = MakePropertyValue("Overwrite", True)
myDoc.storeAsURL(Url, arg)
myDoc.close(True)
End Sub
Code: Select all
Sub ConnectOpenOffice()
If IsOpenOfficeConnected() Then Exit Sub
Try
OpenOffice = CreateObject("com.sun.star.ServiceManager")
Catch
OpenOffice = Nothing
End Try
If isNullEmpty(OpenOffice) Then
Err.Raise(vbObjectError + OOoErrorN, "OpenOffice", OOo_connectKO)
Else
StarDesktop = CreateUnoService("com.sun.star.frame.Desktop")
OOoIntrospection = CreateUnoService("com.sun.star.beans.Introspection")
OOoDisp = CreateUnoService("com.sun.star.frame.DispatchHelper")
OOoTypeDescrMngr = OpenOffice.DefaultContext.getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager")
End If
End Sub
Function dummyArray() As Object
' cree un tableau vide, pour une liste vide
' creates an empty array for an empty list
Dim Result(-1) As Object
dummyArray = Result
End Function
Function MakePropertyValue(ByVal PropName As String, ByVal PropValue As Object) As Object
' equivalent de la fonction de Danny Brewer
' equivalent to Danny Brewer's function
Dim Result As Object
Result = OpenOffice.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
Result.Name = PropName
Result.Value = PropValue
MakePropertyValue = Result
End Function
Please, can you help me. Thank you in advance. Regards