Macro to Create "Unicode" Styles in WordPerfect


While no genuine Chinese alphabet exists, if one doesn't know Chinese, but is given English characters to copy-type Chinese words, then a "Chinese" keyboard mapped to the "Unicode" Chinese character styles assigned to macros launched using keyboard shortcuts is a workaround that will enable a WordPerfect user to produce documents that are written in Chinese using Unicode characters. Let me emphasize that this workaround is necessary since WordPerfect doesn't support Unicode.

[code]
Application (WordPerfect; "WordPerfect"; Default!)

// Lower-case letters
FORNEXT (i; 1; 26; 1)
sname:="ltr" + NTOC(i + 96)
fname:="c:\Chinese\newltr" + i + ".jpg"
AddStyle (sname; fname)
StyleSystemOn (sname)
ENDFOR
QUIT
[/code]

OR

[code]
Application (WordPerfect; "WordPerfect"; Default!)

// Upper-case letters
FORNEXT (i; 1; 26; 1)
sname:="ltr" + NTOC(i + 64)
fname:="c:\Chinese\newltrC" + i + ".jpg"
AddStyle (sname; fname)
StyleSystemOn (sname)
ENDFOR
QUIT
[/code]

//sname:="ltra"
//fname:="C:\MyFiles\newltr1.jpg"
//AddStyle (sname; fname)
//StyleSystemOn (sname)
//QUIT

Code continues here:

[code]
PROCEDURE AddStyle (s; f)
StyleCreate (s; ParagraphStyle!; Library: CurrentDoc!)
StyleEditBegin (s; CurrentDoc!)
StyleCodes (WithoutOffCodes!)

BoxCreate ("I&mage")
BoxContentType (Image!)
BoxImageRetrieve (MakeInternal!; f)
BoxAttachTo (Character!)
BoxWidth (0.3")
BoxUpdateDisplay
BoxImageScaling (3.0; 3.0)
BoxWidth (Width: 0.3")
BoxImageScaling (3.0; 3.0)
BoxEnd (Save!)

StyleRename (s)
StyleType (OpenStyle!)
SubstructureExit
StyleEditEnd (Save!)
ENDPROC
[/code]