taupe59 wrote:
args2(1).Name = "Filter"
args2(1).Value = "Text (encoded)"
Did you realise that the macro used
Filter for the parameter name and
not Filtername?
In the Basic documentation wiki as referenced above I find only Filtername, FilterData and FilterOptions, but barely Filter seems to be undocumented or was added in later versions of OOo that are not yet covered by that macro documentation.
When I used your code I could reproduce the behaviour that you described (but for me there is still no character set dialog popping up!):
Code: Select all
Sub loadPlainTextFile
Dim oDoc As Object
Dim FileProperties(0) As New com.sun.star.beans.PropertyValue
Dim sUrl As String
sUrl = ConvertToURL("C:\home\run\calendar_1262007213789.ics")
FileProperties(0).Name = "Filter"
FileProperties(0).Value ="Text (encoded)"
oDoc = StarDesktop.loadComponentFromURL(sUrl, "_blank", 0, FileProperties())
Xray oDoc
End Sub
The .ics file is the one from my last post (UTF-8, but without BOM) and Xray (an object inspector tool -- very useful, just google for it and you will find where to download it) tells me that the object variable
oDoc is NULL.
That means it is not the document that is hidden, but loading the document with
loadComponentFromURL failed!
Can't really say it from the .ofx content that you cut and pasted here, but what you tell about notepad not showing the linebreaks looks like the content has Unix linebreaks (LF only) and maybe at the last line a CR/LF. A single LF is used during the export to encoded text for soft line breaks (start a new line in WYSIWYG, but not a new paragraph) while a full DOS CR/LF completes a paragraph and starts a new one in Writer WYSIWYG.
So I think if you are asked for ascii filter options it is not for the characterset, but for the linebreak because OOo finds two types of linebreaks in the file content.
Hm, if I try to import a file with CR/LF and LF at the same time it directly shows the open document, no options dialog!
Maybe someone else knows more than me about this undocumented "Filter" parameter?!
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.