pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Fri Mar 11, 2005 7:22 am Post subject: Database connection to a fixed width flat file |
|
|
I know how to connect to a delimited text file...
| Code: | sURL = "sdbc:flat:" & GetSourceCodeDir() & "whatever.csv"
oManager = CreateUnoService("com.sun.star.sdbc.DriverManager")
oDriver = oManager.getDriverByURL(sURL)
AppendProperty(oParms(), "Extension", "csv")
AppendProperty(oParms(), "HeaderLine", False)
AppendProperty(oParms(), "FieldDelimiter", ",")
AppendProperty(oParms(), "StringDelimiter", """")
AppendProperty(oParms(), "DecimalDelimiter", ".")
AppendProperty(oParms(), "ThousandDelimiter", ",")
oCon = oManager.getConnectionWithInfo(sURL, oParms())
|
If the file is NOT delimited, however, I do not know how to create a database connection to the file. I do know that there is a "FixedLength" property, but the description is as follows:
| Quote: | | True when all occurrences of "?" as a parameter name will be replaced by a valid parameter name. This is necessary, because some drivers mix the order of the parameters. |
I assume that I will need to read the file into a Calc document and then use that as my data source... _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Wed Mar 16, 2005 2:02 pm Post subject: |
|
|
I decided that you probably can not do this, so I wrote a macro that imports the fixed width file into a Calc document and then writes it out as both a delimited document and a Calc document. I can then access either of these formats as I deisre.... _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|