-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNew.PRG
More file actions
47 lines (42 loc) · 875 Bytes
/
New.PRG
File metadata and controls
47 lines (42 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Lparameters cText,nConvert,lNoRelease
&& if nConvert=1 then convert GbK to GbW, else if nConvert=0 or 2 then gb2 to GbK
If Vartype(cText)<>'C' OR Empty(cText) Then
Return ''
EndIf
If Vartype(nConvert)<>'N' Then
Return ''
Else
If nConvert>=0 and nConvert<=2 Then
If Abs(nConvert)<>1 Then
nConvert=0
Else
nConvert=1
EndIf
Else
Return ''
EndIf
EndIf
If nConvert=1 Then
nConvert=0
Else
nConvert=1
EndIf
If Vartype(oWord)='U' Then
Public oWord
oWord=CreateObject('Word.Application')
EndIf
oWord.Visible=.T.
cTempError=On('Error')
TempIsError=.F.
On Error TempIsError=.T.
TempCount=oWord.Documents.Count
If TempIsError Then && No Document added
On Error &cTempError.
oWord.Documents.Add()
EndIf
oWord.Selection.Text=cText
oWord.Selection.Range.TcscConverter(nConvert,.T.,.T.)
Return oWord.Selection.Text
If Not lNoRelease Then
Release oWord
EndIf