Opening/importing wk1 files in macro?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
tvandel
Posts: 1
Joined: Sat Jun 07, 2008 9:29 am

Opening/importing wk1 files in macro?

Post by tvandel »

We still have a conversion tool running on an old system that creates xls files which are in fact the old Lotus wk1 format.

Openoffice scalc is able to open them, but I've a problem in batch mode using a macro

As users can no longer open these files in Excel 2007 I'm just trying to put in place a script that would call an OOo basic macro to convert them in a more recent Excel format.

I'm using the macro below that work fine for other formats but have an issue to open wk1

Any help much appreciated .. should I use a filter .. and if yes which one?

Thanks
TV

Sub convrt( cFile )
Dim adresseDoc As String
Dim propFich()
Dim oDoc()


cURL = ConvertToURL( cFile )
oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, (Array(MakePropertyValue( "Hidden", True ),))

cFile = Left( cFile, Len( cFile ) - 4 ) + ".xls"
cURL = ConvertToURL( cFile )

oDoc.storeToURL( cURL, Array(MakePropertyValue( "Hidden", False ),_
MakePropertyValue( "AsTemplate", False ),_
MakePropertyValue( "FilerName", "MS Excel 97" ) ) )
oDoc.close( True )

End Sub

'----------
' Create and return a new com.sun.star.beans.PropertyValue.
'
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
Post Reply