Page 1 of 1

RTF Stylesheets

Posted: Sun Nov 27, 2022 9:03 pm
by offsides
Are stylesheets supported by the EditorGadget?

This does not work as written. It works fine if the stylesheet definitions are plugged directly into the text.

Code: Select all

Txt$ = "{\rtf1\ansi\deflang1033\deff0" +
       "{\fonttbl" +
       "{\f0\fnil Arial;}" +             
       "{\f1\fnil Courier New;}" + 
       "{\f2\fnil Lucida Console;}" +
       "{\f3\fnil Comic Sans MS;}}" +       
       "{\colortbl;" +                   
       "\red255\green0\blue0;" +        
       "\red0\green255\blue0;" +
       "\red0\green0\blue255;}" +
       "{\stylesheet" +
       "{\s1 \pard\plain\f0\cf1\fs40\b\qc;}" +    
       "{\s2 \pard\plain\f0\cf3\fs30\b\i\ql;}" + 
       "{\s3 \pard\plain\f0\fs20\ql;}}" +
       "{\s1 Main Title\par}" +
       "{\s2 Top Heading\par}" + 
       "{\pard\plain " + 
       "Lorem ipsum  dolor sit amet folder" + 
       "consectetuer vel \b Pellentesque \b0 justo" +  
       "quis ac. Elit vitae enim Aenean Ut\line\par}" +     
       "{\s2 Second Heading\par}" + 
       "{\pard\plain\f2 " + 
       "Donec dapibus tristique. Mauris" + 
       "sollicitudin nunc nulla urna Aenean" + 
       "convallis ante id Curabitur penatibus." + 
       "Tincidunt ipsum nec neque Praesent"

Re: RTF Stylesheets

Posted: Sun Nov 27, 2022 9:37 pm
by infratec
This code is incomplete (no closing bracket at the end) and it is not runable to see something.

So what do you expect?

But I think the EditorGadget is not a text processing program.
It has no 'menu' to select stylesheets, also no parameter to add one.
So I think the answer is: no, it does not support 'selectable' stylesheets.

Re: RTF Stylesheets

Posted: Sun Nov 27, 2022 11:31 pm
by offsides
infratec,

The code is just a snippet from a much longer bit of test code, hence no "}". The code is either syntactically correct or not, I guess that was my question. Sorry.

The EditorGadget (or Edit Control) is described as rendering RTF if it sees any. It seems to handle all the standard commands like \fN, \cfN, \par, \pard, etc. etc. but does not do escapes like \'xx. Stylesheets, as you know, are like macros and are defined in the prolog by the author. They become shortcuts for lengthy code groups that might appear more than once in a document. They are so handy, I expected they would be supported.

Thanks, for your comment.