![]() |
|
#1
|
|||
|
|||
![]()
Hi,
i want to read the data from the attached excel file. I have problems displaying the turkish chars. after my import script, all special C and S are converted to plain C and S any suggestions ? |
#2
|
||||
|
||||
![]()
LxRAE,
Sorry for the delay... One way to solve the problem is to make sure that Turkish code page is set as default on your Windows. Everything should work OK then. However if you want to use any other Windows language (e.g. English, Greek, etc) and still want to get Turkish text into CorelDRAW 11, here is one way to do it: Code:
Option Explicit Private Declare Function WideCharToMultiByte Lib "kernel32" _ (ByVal CodePage As Long, ByVal dwFlags As Long, _ ByRef lpWideCharStr As Integer, ByVal cchWideChar As Long, _ ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, _ Optional ByVal lpDefaultChar As Long = 0, _ Optional ByVal lpUsedDefaultChar As Long = 0) As Long Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" _ (ByVal lpString As String) As Long Sub ReadExcel() Dim cnn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim s As String ' Open the connection to an Excel file cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\data.xls;" & _ "Extended Properties=""Excel 8.0; HDR=No;""" rs.Open "SELECT * FROM [Tabelle1$a1:a13]", cnn, _ adOpenForwardOnly, adLockReadOnly s = "" While Not rs.EOF If s <> "" Then s = s & vbCrLf s = s & rs!F1 rs.MoveNext Wend rs.Close cnn.Close Set rs = Nothing Set cnn = Nothing ActiveLayer.CreateArtisticText 0, 10, ConvertToANSI(s, 1254), _ cdrTurkish, cdrCharSetTurkish, "Arial" End Sub Private Function ConvertToANSI(ByVal s As String, ByVal CodePage As Long) As String Dim sa As String Dim ln As Long Dim str() As Integer Dim n As Long ln = Len(s) ReDim str(0 To ln) For n = 0 To ln - 1 str(n) = AscW(Mid$(s, n + 1, 1)) Next n str(ln) = 0 sa = Space$(ln) WideCharToMultiByte CodePage, 0, str(0), ln, sa, ln ConvertToANSI = Left$(sa, lstrlen(sa)) End Function The above example is also useful in that it shows how to use ADO (ActiveX Data Objects) to access excel file without even launching Excel. (Just make sure you add a reference to "Microsoft ActiveX Data Objects 2.* Library" from your VBA project => Go to Tools>References in CorelDRAW's VBA Editor). Now, with CorelDRAW 12 everything is so much simpler because Draw 12 is a Unicode application now, so the tricks with playing with codepages is gone now: Code:
Sub ReadExcel() Dim cnn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim s As String ' Open the connection to an Excel file cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\data.xls;" & _ "Extended Properties=""Excel 8.0; HDR=No;""" rs.Open "SELECT * FROM [Tabelle1$a1:a13]", cnn, _ adOpenForwardOnly, adLockReadOnly s = "" While Not rs.EOF If s <> "" Then s = s & vbCrLf s = s & rs!F1 rs.MoveNext Wend rs.Close cnn.Close Set rs = Nothing Set cnn = Nothing ActiveLayer.CreateArtisticText 0, 10, s, Font:="Arial" End Sub |
#3
|
|||
|
|||
![]()
(!) THANK YOU SIR - up to now i didnt try the code but i'm sure it will fit.
![]() ![]() ![]() ![]() |
#4
|
|||
|
|||
![]() Quote:
SELAM SANIRIM TÜRKSÜNÜZ, B&#304;LG&#304; ALI&#350;VER&#304;&#350;&#304;NDE BULUNMAK &#304;STER&#304;M. &#304;Y&#304; GÜNLER D&#304;L&#304;YORUM. |
#5
|
|||
|
|||
![]()
muah
![]() buddy, i have no idea what u wan me to tell ![]() ![]() ![]() |
#6
|
|||
|
|||
![]()
: ))) lol.... i thought that you are Turkish, what a fool i am.. anyway no problem pal, enjoy your self. good day...
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
delete vba project from cdr file | hotairballoon | CorelDRAW/Corel DESIGNER VBA | 1 | 18-05-2005 09:08 |
File Convertor to do transpararent TIFFs | dan | CorelDRAW/Corel DESIGNER VBA | 8 | 22-12-2004 13:23 |
Is Corel to Excel data exchange possible? | alex69 | CorelDRAW/Corel DESIGNER VBA | 8 | 24-06-2004 04:52 |
reading data from file and generate "labels" | LxRAE | CorelDRAW/Corel DESIGNER VBA | 4 | 23-01-2004 04:05 |
Open - Resize - Savefile in Photo Paint | greenee | Corel Photo-Paint VBA | 2 | 28-06-2003 03:54 |