 | OO-Snippets: Importing a plain text encoded with a given character setCommons| Keywords | Text (encoded), FilterOptions |
|---|
| Language | OOBasic |
|---|
| Application | Writer |
|---|
| Authors | Cedric Bosdonnat (initial)
|
|---|
| Supported Versions | 2.0.x |
|---|
| Supported OS | All |
|---|
| Question | How to import a plain text file encoded with a given character set
Simply suppose we need to import MyTest.txt which is encoded in IBM850, also knwon as cp850.
|
|---|
| Answer | For this, we need to use the 'Text (encoded)' filter and configure it properly as shown by the code snippet. The possible character set codes are all listed on this page: http://equalitylearning.org/~robertz/oo_encoding_indexes.html |
|---|
Dim oMediaDescriptor(1) as new com.sun.star.beans.PropertyValue
sFileUrl = convertToUrl( "H:\My Test.txt" )
oMediaDescriptor(0).name = "FilterName"
oMediaDescriptor(0).value = "Text (encoded)"
oMediaDescriptor(1).name = "FilterOptions"
oMediaDescriptor(1).value = "IBM_850"
oDoc = StarDesktop.loadComponentFromURL(sFileURL, "_blank", 0, oMediaDescriptor)
|
Changelog| Date | User | Modification |
|---|
| 2007-01-03 | cedricbosdo | Initial version |
|