Ask Your Question
1

import dbase via Basic - how to select character set [closed]

asked 2018-02-08 11:01:32 +0200

hasklo gravatar image

I am trying to programmatically open a dbase (.dbf) file using Basic. It opens fine, but because the file has Chinese characters, it's not displaying the Chinese characters correctly. When I try to open the dbase file manually with Calc, the "Import Dbase files" dialog pops up and asks for the Character set. If I then select "Big5", the file opens and displays Chinese characters correctly.

So my question is: how to open the dbase file using Basic with Character set "Big5"? I have tried the following for my code, but I am not sure what I should set as the value of the FilterOptions.

Dim aDocProps(2) As New com.sun.star.beans.PropertyValue
Dim oDoc as Object

aDocProps(0).Name = "Hidden"
aDocProps(0).Value = False
aDocProps(1).Name  = "FilterName"
aDocProps(1).Value = "dBase"
aDocProps(2).Name  = "FilterOptions"
aDocProps(2).Value = 1

oDoc = StarDesktop.LoadComponentFromUrl(ConvertToURL("my.dbf"), "_blank", 0, aDocProps)

I am using LO 5.3.7.2 x64

Locale: zh-TW (zh_TW)

In the "Options - Language Settings - Languages":

  • Locale setting: Default - Chinese (traditional)
  • Western: Default - English (USA)
  • Asian: Default - Chinese (traditional)

Thanks!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by erAck
close date 2018-02-09 15:54:06.597580

1 Answer

Sort by » oldest newest most voted
2

answered 2018-02-09 01:02:30 +0200

erAck gravatar image

For Big5 try "68" (note that the option's value is of type string), see Filter Options in old OOo wiki

edit flag offensive delete link more

Comments

Thank you so much, that did the trick! I was looking for a page like this, but didn't turn up on the search... I really need to work on my searching skills.

hasklo gravatar imagehasklo ( 2018-02-09 08:42:02 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2018-02-08 11:01:32 +0200

Seen: 31 times

Last updated: Feb 09