I've been trying to learn OOo scripting, and so far I've learned a few
things by finding examples. For instance, to open a text file and read
from it, you have to do something like this:
FilePickerDlg = createUnoService( "com.sun.star.ui.dialogs.FilePicker" )
FilePickerDlg.appendFilter( "DSX Files", "*.dsx" )
selected = FilePickerDlg.execute()
Files = FilePickerDlg.getFiles()
FileName = ConvertFromURL( Files(0) )
Doc = StarDesktop.CurrentComponent
Sheet = Doc.Sheets.getByName("Control")
SFA = createUnoService( "com.sun.star.ucb.SimpleFileAccess" )
InFile = SFA.openFileRead( FileName )
TextInputStream = createUnoService("com.sun.star.io.TextInputStream")
TextInputStream.setInputStream(InFile)
TextLine = TextInputStream.readLine()
Sheet.getCellByPosition(0, 0).String = TextLine
First of all, that's a lot more complex than in Excel:
importfile = Application.GetOpenFilename("DSX Files (*.dsx), *.dsx")
Open importfile For Input As #1
Line Input #1, TextLine
Cells(0, 0) = TextLine
Secondly, where am I supposed to find out all that createUnoService
stuff? I could only write the above by spending three evenings
searching the interwebs for examples and asking either here or on a
newsgroup.
I think OOo is great, but I'm really struggling with this. Are any of
the other scripting languages easier to use than OOo Basic?
Phil Hibbs.
--
Don't you just hate self-referential sigs?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]