[AccessD] OT: Writing raw RTF document using VB/VBA/C(++)/DELPHI/...

Bryan Carbonnell Bryan_Carbonnell at cbc.ca
Fri May 23 10:56:41 CDT 2003


Shamil,

RTF Files are just plain old ascii text. So Low level File I/O will work to write it.

The biggest challenge would be to get the text string correct before writing them out to the file.

Here is a link to the RTF spec.

http://msdn.microsoft.com/library/?url=/library/en-us/dnrtfspec/html/rtfspec.asp?frame=true

As for PDF, here is the link to the PDF Specs.

http://partners.adobe.com/asn/acrobat/docs.jsp#filefmtspecs

Bryan Carbonnell
bryan_carbonnell at cbc.ca

>>> shamil at smsconsulting.spb.ru 23-May-03 11:37:38 AM >>>
Hi All,

Has anybody seen on the Internet any advanced code samples of writing raw
text of RTF documents with different formatting styles, headings, lists,
tables etc. using VB/VBA/C#/C(++)/ <literally any programming language> but
without usage of ActiveX controls, without  MS Word Automation etc. - i.e.
just plain raw code to write raw RTF like in P.S. of this message?
And maybe .PDF too? - or this latter is too much to have for free? - maybe
then good description of .PDF format in electronic form or printed as a
book? Any useful refs on that?

TIA for any info,
Shamil

P.S. Raw rtf sample

{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset204\fprq2{\*\pa
nose 02020603050405020304}Times New
Roman;}{\f1\fswiss\fcharset204\fprq2{\*\panose 020b0604020202020204}Arial;}
{\f2\fmodern\fcharset204\fprq1{\*\panose 02070309020205020404}Courier
New;}{\f3\froman\fcharset2\fprq2{\*\panose
05050102010706020507}Symbol;}{\f14\fnil\fcharset2\fprq2{\*\panose
05000000000000000000}Wingdings;}
{\f30\froman\fcharset0\fprq2 Times New Roman;}{\f28\froman\fcharset238\fprq2
Times New Roman CE;}{\f31\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman Tur;}
{\f33\froman\fcharset177\fprq2 Times New Roman
(Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman
(Arabic);}{\f35\froman\fcharset186\fprq2 Times New Roman
Baltic;}{\f38\fswiss\fcharset0\fprq2 Arial;}{\f36\fswiss\fcharset238\fprq2
Arial CE;}
{\f39\fswiss\fcharset161\fprq2 Arial Greek;}{\f40\fswiss\fcharset162\fprq2
Arial Tur;}{\f41\fswiss\fcharset177\fprq2 Arial
(Hebrew);}{\f42\fswiss\fcharset178\fprq2 Arial
(Arabic);}{\f43\fswiss\fcharset186\fprq2 Arial Baltic;}
{\f46\fmodern\fcharset0\fprq1 Courier New;}{\f44\fmodern\fcharset238\fprq1
Courier New CE;}{\f47\fmodern\fcharset161\fprq1 Courier New
Greek;}{\f48\fmodern\fcharset162\fprq1 Courier New
Tur;}{\f49\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
{\f50\fmodern\fcharset178\fprq1 Courier New
(Arabic);}{\f51\fmodern\fcharset186\fprq1 Courier New
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\b
lue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\g
reen128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\b
lue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue19
2;}{\stylesheet{
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0
Normal;}{\s3\ql
\li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\
lin0\itap0
\b\f1\fs26\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0
\snext0 heading 3;}{\*\cs10 \additive Default Paragraph
Font;}}{\*\listtable{\list\listtemplateid-1472272512\listhybrid{\listlevel\l
evelnfc23\levelnfcn23\leveljc0\leveljcn0
\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltempl
ateid67698695\'01\u-3983
?;}{\levelnumbers;}\f14\fs16\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li720\jclisttab\tx720 }{\listlevel\levelnfc23\levelnfcn23
\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\l
eveltext\leveltemplateid67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\b
rdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li1440\jclisttab\tx1440 }{\listlevel\levelnfc23
\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\lev
elindent0{\leveltext\leveltemplateid67698693\'01\u-3929
?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2160\jclisttab\tx2160 }
{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstar
tat1\levelspace360\levelindent0{\leveltext\leveltemplateid67698689\'01\u-391
3 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li2880
\jclisttab\tx2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\lev
elfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplatei
d67698691\'01o;}{\levelnumbers;}\f2\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li3600\jclisttab\tx3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\
leveltemplateid67698693\'01\u-3929
?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li4320\jclisttab\tx4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\
leveltemplateid67698689\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr
\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li5040\jclisttab\tx5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\
leveltemplateid67698691\'01o;}{\levelnumbers;}\f2
\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li5760\jclisttab\tx5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0
\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\
leveltemplateid67698693
\'01\u-3929 ?;}{\levelnumbers;}\f14\chbrdr\brdrnone\brdrcf1
\chshdng0\chcfpat1\chcbpat1\fbias0
\fi-360\li6480\jclisttab\tx6480 }{\listname
;}\listid2140488109}}{\*\listoverridetable{\listoverride\listid2140488109\li
stoverridecount0\ls1}}{\info
{\title This is a header}{\author Shamil Salakhetdinov}{\operator Shamil
Salakhetdinov}{\creatim\yr2003\mo5\dy23\hr19\min30}{\revtim\yr2003\mo5\dy23\
hr19\min31}{\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\comp
any SMS Consulting Ltd.}
{\nofcharsws0}{\vern8269}}\margl1701\margr850\margt1134\margb1134
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospacef
orul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1701\dgvori
gin1134\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale130\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine
\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
\fet0\sectd
\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultc
l
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl
5
\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
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \s3\ql
\li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel2\adj
ustright\rin0\lin0\itap0
\b\f1\fs26\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {This is a
header
\par {\listtext\pard\plain\f14\fs16 \loch\af14\dbch\af0\hich\f14
\'71\tab}}\pard\plain \ql
\fi-360\li720\ri0\widctlpar\jclisttab\tx720\aspalpha\aspnum\faauto\ls1\adjus
tright\rin0\lin720\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {list line1

\par {\listtext\pard\plain\f14\fs16 \loch\af14\dbch\af0\hich\f14
\'71\tab}list line2
\par {\listtext\pard\plain\f14\fs16 \loch\af14\dbch\af0\hich\f14
\'71\tab}etc\'85
\par }}

--
e-mail: shamil at smsconsulting.spb.ru 
Web: http://www.smsconsulting.spb.ru/shamil_s 


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list