Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oleRTF - NumbericList or OrderedList 2

Status
Not open for further replies.

Koen Piller

Programmer
Jun 30, 2005
841
NL
Hi,
I am looking for the coding to insert a numbericlist[ol 1]
[li]first item[/li]
[/ol]
in with oleRTF. This is possible if you put following code in your field:

Code:
\par \pard{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pndec{\pntxta.}}
\fi-360\li480\sa50\sl0\slmult1

and

~~~
and
Code:
\par \pard

My problem is how to put these lines into my text?

An example how the text would look like:

Code:
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}
\viewkind4\uc1\pard\fi-360\li480\sa50\sl0\slmult1\qj\lang1043\fs18
\par This is record number 9 DistributedThis is record number 9 Distributed
\par
\par
\par \pard{\pntext\f0 1.\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pndec{\pntxta.}}
\fi-360\li480\sa50\sl0\slmult1 The first line
\par {\pntext\f0 2.\tab}The second line
\par {\pntext\f0 3.\tab}The third line
\par \pard\li120\sa50\sl0\slmult1
\par \pard There is a quick brown fox jumping in the woods. The Fox is a mother fox with 3 young foxes, Papa fox was shot by the royal hunters, they will celebrate a fine hunting feast. Hunters where also looking for a wild turkey to make het hunting dinner for X-mas a great succes, unfortunately they could not find one. And for the rest this piece of text is just for testing an to show hwat is the effect of the different alignment commands.
\par \tab Skip to see the effect of the other buttons.
\par
\par normal text
\par }

Anybody around who is familiar with oleRTF coding?

Stay healthy,

Koen


P.S. I studied Mike's however it does not give me the clue how to do what I want.
 
I see an advantage: the overall document RTF might stay cleaner and leaner this way.

And Koen, the only essential code is the first one, sending a message to the OLE RTF Control (so this is also based on the control). I guess you could also create the necessary struct specifically for this call without using the posted class, it's just also handy to have such a struct class anyway, for all API functions requiring a struct.

The only "problem" I see using this interface is that this means learning another object model and needing to know more constants, etc. I'd rather look for a tool able to simplify final RTF code and use the easy "hack" of using SeRTF to push RTF snippets into the control instead of using clipboard in RTF format or SendMessage.




Chriss
 
Koen,

How serious are you about doing this the right way? You mentioned that you wanted to mimic some gmail functionality. To do this the right way, forget about using TEXT...ENDTEXT with RTF codes. The "right way" requires you to become familiar with the PARAFORMAT structure and to implement it accordingly - we also use Christof's struct class for this. There is no fast and easy way for the right way.

Another thing to keep in mind is that the RichText ActiveX control (that ships with VFP) uses Microsofts Rich Edit Version 1.0 (Riched32.dll) which has limited capabilities:
For good performance, you should also enable ActiveX dual interface support by setting SYS(2333,1) before the RTF control instantiates.

Below are two partial screen shots showing our RTF editor. It has all the functionality of WordPad and more. The code for this is part of our proprietary framework, so we cannot share it. However, the code provided by ggreen61 (shown above) is similar to what we use for bulleted and numbered lists. You many want to consider downloading Christof's struct class and learn how to use it: And here is the link to info on the Microsoft PARAFORMAT structure:
Sorry for the fuzzy screen shots - can't be helped.

Email1_lvhmut.jpg


Email3_fnt8rl.jpg


Email2_rertrq.jpg
 
Vernpace,

Thanks for your good advice.As usual Microsoft offers multiple options to perform a task. In my case I am happy with oleRTF, to make a numbered list, add an other button, for easy reference call it cmdNumbered in the click event you put the lines of code as in my initial question. That's it. Nothing more.
Activate the form, in the container / editbox you move your cursor to the position where you would like to start the list and next you click on that cmdNumbered and oleRTF is doing the job. Easy as 1+1

Will study also the URL you indicated with the shortcomings. Thanks.

Stay healty,

Koen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top