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:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
|
lnHndl = rtfCreateFile("C:\TEMP\test.rtf")
= rtfPutText( lnHndl, "Sample RTF output", .t., .t., .f., 0, 14, .t.)
= rtfCloseFile( lnHndl)
FUNCTION RtfCreateFile
PARAMETERS lcFileName
LOCAL lnHndl
lnHndl = fCreate( lcFileName)
IF lnHndl > 0
=fPutS( lnHndl,'{\rtf1\ansi\ansicpg1250\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}')
=fPutS( lnHndl,'{\f44\froman\fcharset238\fprq2 Times New Roman CE;}{\f45\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f47\froman\fcharset161\fprq2 Times New Roman Greek;}{\f48\froman\fcharset162\fprq2 Times New Roman Tur;}')
=fPutS( lnHndl,'{\f49\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f50\fswiss\fcharset238\fprq2 Arial CE;}{\f51\fswiss\fcharset204\fprq2 Arial Cyr;}{\f53\fswiss\fcharset161\fprq2 Arial Greek;}{\f54\fswiss\fcharset162\fprq2 Arial Tur;}')
=fPutS( lnHndl,'{\f55\fswiss\fcharset186\fprq2 Arial Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;')
=fPutS( lnHndl,'\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\lang3081\cgrid \snext0 Normal;}{\*\cs10 \additive ')
=fPutS( lnHndl,'Default Paragraph Font;}}{\info{\title Computation rule list by Lukas Casar}{\author [email protected], 0603 442292}{\operator [email protected], 0603 442292}')
=fPutS( lnHndl,'{\creatim\yr2001\mo2\dy20\hr10\min10}{\revtim\yr2001\mo2\dy20\hr10\min22}{\version3}{\edmins8}{\nofpages1}{\nofwords0}')
=fPutS( lnHndl,'{\nofchars0}{\*\company Integia s.r.o.}{\nofcharsws0}{\vern113}}\paperw11906\paperh16838 \widowctrl\ftnbj\aenddoc\hyphcaps0\formshade\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot \fet0\sectd \linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl ')
=fPutS( lnHndl,'{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5')
=fPutS( lnHndl,'\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang')
=fPutS( lnHndl,'{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \widctlpar\adjustright \fs20\lang3081\cgrid ')
ENDIF
RETURN lnHndl
FUNCTION RtfPutText
Parameters lnHndl, lcText, llBold, llUnderline, llItalic, lnColor, lnFontSize, llCrLf
LOCAL lcStr
lcStr = '{\f1' + IIF( lnFontSize=0 , '', '\fs'+ ALLTRIM( STR( lnFontSize*2)))
lcStr = lcStr + IIF( llBold, '\b' , '')
lcStr = lcStr + IIF( llUnderline, '\ul' , '')
lcStr = lcStr + IIF( llItalic, '\i' , '')
lcStr = lcStr + IIF( EMPTY( lnColor), '' , '\cf' + ALLTRIM( STR( lnColor)))
lcStr = lcStr + '\lang1033 ' + lcText
IF llCrLf
= fPutS ( lnHndl, lcStr)
= fPutS ( lnHndl ,'\par }')
ELSE
= fPutS ( lnHndl, lcStr + '}')
ENDIF
RETURN
FUNCTION RtfCloseFile
PARAMETER lnHndl
=fPutS( lnHndl,'{\i\cf2\lang1033 \par }}')
RETURN fClose( lnHndl)
|