It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

encoding issue while opening an excel file

Moderator: dafunkymunky

encoding issue while opening an excel file

Postby SimeonMattes on Mon Jan 18, 2010 9:35 am

Hi,

I have a problem with the encoding of characters when I try to open an excel file....Let's say that the excel file has the following text:

Greek | English | German
α,β,γ .. | a,b,c,... | a,b,c...ä,ü,ö

I have just written the first three letters of the alphabet and in German some extra characters.

The code I use to open this excel file is

Code: Select all
FileSelector.Title = "Load Excel File..."
            FileSelector.InitialPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            Dim path As String = FileSelector.BrowseFile(fileExtensions) 'Dim file As String = FileSelector.BrowseFile(FileType.Img)
            If path Is Nothing Then 'If the user has chosen cancel
                Return Nothing
            End If

            'read the file
            doc = CompoundDocument.Read(path)
            Dim bookdata As Byte() = doc.GetStreamData("Workbook")
            book = New Workbook()
            book.Read(New MemoryStream(bookdata))


The problem is that the extra characters in the German language are not read correctly, i.e.

Code: Select all
MsgBox(book.Worksheets(0).Cells(1,2))


gives me as a result
Code: Select all
a,b,c...?,?,?


instead of
Code: Select all
a,b,c...ä,ü,ö


This problem doesn't appear in the greek language...

Thanks in advance
SimeonMattes
 
Posts: 1
Joined: Mon Jan 18, 2010 9:15 am

Who is online

Users browsing this forum: No registered users and 5 guests