OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 31-03-2003, 08:43
Dino
Guest
 
Posts: n/a
Default Whether the VBA can work with Unicode .

Whether the VBA can work with Unicode .

Code:
Sub Test()
Dim Name As String, T As Shape
	Name = InputBox("Input Name")
		Set T = ActivePage.TextFind("Fields", False)
	With ActiveShape.Text
		.Contents = Name
	End With
End Sub
If I enter the Russian text that in the document it becomes invisible.
I think that VBA for CorelDraw does not support Unicode.
Reply With Quote
  #2  
Old 31-03-2003, 12:55
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Whether the VBA can work with Unicode .

Dino,

The answer is both "Yes" and "No". CorelDRAW is not yet a true Unicode application, so it doesn't handle the text through Unicode per se. However it still can support multiple code pages in the same document, so you still can show Cyrillic, Central European, Western and other characters at the same time.

CorelDRAW 11 has expanded its object model with advanced text handling messages which automatically convert Unicode characters from VBA (you need to use Shape.Text.Story, for example, instead of the old Shape.Text.Contents property). However if you are still under CorelDRAW 10 or 9, you will need to use a "hack" I explained in the following thread: Special Characters
Reply With Quote
  #3  
Old 02-04-2003, 10:09
Dino
Guest
 
Posts: n/a
Default Thank, Alex!

Thank, Alex!

Your consutation very much has helped me.
Reply With Quote
  #4  
Old 02-04-2003, 23:21
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Thank, Alex!

Quote:
Originally Posted by Dino
Your consutation very much has helped me.
You are very welcome. By the way, I'm originally from the Ukraine as well (Kiev)
Reply With Quote
  #5  
Old 26-08-2003, 20:35
frankchen
Guest
 
Posts: n/a
Default still doesn't work.

I follow Dino's source code and change to text.shape.story to get value,
which I input. But, I can not see right text in that shape. I use traditional Chinese Windows 2000 OS and input traditional chinese. It seem unicode problems, Do I need to convert to Unicode before I use Text.Shape.Story?
Reply With Quote
  #6  
Old 27-08-2003, 16:13
frankchen
Guest
 
Posts: n/a
Default about shape.text.story problems

I know Shape.text.story return a TextRange object, which has WideText and Text propority. As my opinion, the difference between two propority is WideText use unicode. When I used WideText, I found follow problems:

1:Everything is fine If I change TextRange.WideText with mix Chinese text(had Converted to Unicode) as single font type, which means Text include Chinese character, number and english character, but they are same font.
At this situition, I check TextRange.CharSet and LanguageID, the value as follow.
CharSet:136 (Big5)
LanguageID: 1028 ()

2:the text is invisiable when I change TextRange.WideText with original WideText. The code as follow
Code:
Sub TestChangeText11()
    Dim strInput As String
    Dim strUnicode As String
    Dim strBig5 As String
    Dim oDocument As Document
    Dim oPage As Page
    Dim oShape As Shape
    Dim oTextRange As TextRange
    Dim oNewTextRange As TextRange
    'strInput = InputBox("Input")
    Set oDocument = Application.ActiveDocument
    Set oPage = oDocument.ActivePage
    Set oShape = oPage.FindShape(, , 14727)  '14727; '8
    If oShape Is Nothing Then
        MsgBox "Can not find shape"
    Else
        Set oTextRange = oShape.Text.Story
        strUnicode = oTextRange.WideText
        'I write Unicode To Big 5 converter
        strBig5 = UnicodeToBig5(strUnicode)
        MsgBox "CharSet:" & oTextRange.CharSet & vbCrLf & "LanguageID:" & oTextRange.LanguageID
        'the result: CharSet:0
        '                LanguageID:-1
        MsgBox "Text:" & strBig5
        
        oTextRange.WideText = Big5ToUnicode(strBig5)
        
        strUnicode = oTextRange.WideText
        strBig5 = UnicodeToBig5(strUnicode)
        MsgBox "CharSet:" & oTextRange.CharSet & vbCrLf & "LanguageID:" & oTextRange.LanguageID
        'the result: CharSet:0
        '                LanguageID:1033
        MsgBox "Text:" & strBig5
    End If
End Sub
The original text is mixed Chinese text including Chinese character, number and english character, but I used different fonts for chinese character, number and english character.
The most strange thing is that every thing is fine when the first character of original text is chinese character. Otherwise, the text is invisible in CorelDraw when the first character of original text if non-chinese, including number and english character. At this situition, I selected text and edit it in CorelDraw, I found chinese character became blank, and only english character and number show.

I think CorelDraw doesn't know I change mixed text. These problems didn't appear in CorelDraw 10
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 09:08
Text ENCODE Craig Tucker CorelDRAW/Corel DESIGNER VBA 10 26-01-2005 13:59
CD 10, VBA not returning true outline width Webster CorelDRAW/Corel DESIGNER VBA 1 24-11-2004 17:09
VBA does not work with my CD 10 ! jobar CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:38
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 14:35


All times are GMT -5. The time now is 04:09.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com